home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1994-10-19 | 168.5 KB | [ONLN/HLX2] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Thu Oct 13 06:58:34 1994, modified Wed Oct 19 09:36:34 1994, creator 'HLX2', type 'ONLN', 168010 bytes "OV04 Compatibility Why&How" , at 0x290ca 4279 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
100%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [ONLN] |
macFileCreator | [HLX2] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 1a 4f 56 30 34 20 43 | 6f 6d 70 61 74 69 62 69 |..OV04 C|ompatibi|
|00000010| 6c 69 74 79 20 57 68 79 | 26 48 6f 77 00 00 00 00 |lity Why|&How....|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 02 90 4a 00 | 00 10 b7 aa c2 c3 5a aa |......J.|......Z.|
|00000060| ca d1 62 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..b.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 7f bc 00 00 |........|........|
|00000080| 4f 56 20 34 20 2d 20 43 | 6f 6d 70 61 74 69 62 69 |OV 4 - C|ompatibi|
|00000090| 6c 69 74 79 3a 20 57 68 | 79 20 26 20 48 6f 77 0d |lity: Wh|y & How.|
|000000a0| 4f 76 65 72 76 69 65 77 | 09 0d 52 65 76 69 73 65 |Overview|..Revise|
|000000b0| 64 20 62 79 3a 09 09 4d | 61 72 63 68 20 31 39 38 |d by:..M|arch 198|
|000000c0| 38 0d 57 72 69 74 74 65 | 6e 20 62 79 3a 09 42 6f |8.Writte|n by:.Bo|
|000000d0| 62 20 4a 6f 68 6e 73 6f | 6e 09 46 65 62 72 75 61 |b Johnso|n.Februa|
|000000e0| 72 79 20 31 39 38 37 0d | 57 68 69 6c 65 20 63 72 |ry 1987.|While cr|
|000000f0| 65 61 74 69 6e 67 20 6f | 72 20 72 65 76 69 73 69 |eating o|r revisi|
|00000100| 6e 67 20 61 6e 79 20 70 | 72 6f 67 72 61 6d 20 66 |ng any p|rogram f|
|00000110| 6f 72 20 74 68 65 20 4d | 61 63 69 6e 74 6f 73 68 |or the M|acintosh|
|00000120| 2c 20 79 6f 75 20 73 68 | 6f 75 6c 64 20 62 65 20 |, you sh|ould be |
|00000130| 61 77 61 72 65 20 6f 66 | 20 74 68 65 20 6d 6f 73 |aware of| the mos|
|00000140| 74 20 63 6f 6d 6d 6f 6e | 20 72 65 61 73 6f 6e 73 |t common| reasons|
|00000150| 20 77 68 79 20 70 72 6f | 67 72 61 6d 73 20 66 61 | why pro|grams fa|
|00000160| 69 6c 20 6f 6e 20 76 61 | 72 69 6f 75 73 20 76 65 |il on va|rious ve|
|00000170| 72 73 69 6f 6e 73 20 6f | 66 20 74 68 65 20 4d 61 |rsions o|f the Ma|
|00000180| 63 69 6e 74 6f 73 68 2e | 20 54 68 69 73 20 6e 6f |cintosh.| This no|
|00000190| 74 65 20 77 69 6c 6c 20 | 64 65 74 61 69 6c 20 73 |te will |detail s|
|000001a0| 6f 6d 65 20 63 6f 6d 6d | 6f 6e 20 66 61 69 6c 75 |ome comm|on failu|
|000001b0| 72 65 20 6d 6f 64 65 73 | 2c 20 77 68 79 20 74 68 |re modes|, why th|
|000001c0| 65 79 20 6f 63 63 75 72 | 2c 20 61 6e 64 20 68 6f |ey occur|, and ho|
|000001d0| 77 20 74 6f 20 61 76 6f | 69 64 20 74 68 65 6d 2e |w to avo|id them.|
|000001e0| 0d 57 65 d5 76 65 20 74 | 72 69 65 64 20 74 6f 20 |.We.ve t|ried to |
|000001f0| 65 78 70 6c 61 69 6e 20 | 74 68 65 20 69 73 73 75 |explain |the issu|
|00000200| 65 73 20 69 6e 20 64 65 | 70 74 68 2c 20 62 75 74 |es in de|pth, but|
|00000210| 20 72 65 63 6f 67 6e 69 | 7a 65 20 74 68 61 74 20 | recogni|ze that |
|00000220| 6e 6f 74 20 65 76 65 72 | 79 6f 6e 65 20 69 73 20 |not ever|yone is |
|00000230| 69 6e 74 65 72 65 73 74 | 65 64 20 69 6e 20 65 76 |interest|ed in ev|
|00000240| 65 72 79 20 69 73 73 75 | 65 2e 20 46 6f 72 20 65 |ery issu|e. For e|
|00000250| 78 61 6d 70 6c 65 2c 20 | 69 66 20 79 6f 75 72 20 |xample, |if your |
|00000260| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 73 20 6e |applicat|ion is n|
|00000270| 6f 74 20 63 6f 70 79 20 | 70 72 6f 74 65 63 74 65 |ot copy |protecte|
|00000280| 64 2c 20 79 6f 75 d5 72 | 65 20 70 72 6f 62 61 62 |d, you.r|e probab|
|00000290| 6c 79 20 6e 6f 74 20 76 | 65 72 79 20 69 6e 74 65 |ly not v|ery inte|
|000002a0| 72 65 73 74 65 64 20 69 | 6e 20 74 68 65 20 73 65 |rested i|n the se|
|000002b0| 63 74 69 6f 6e 20 6f 6e | 20 63 6f 70 79 20 70 72 |ction on| copy pr|
|000002c0| 6f 74 65 63 74 69 6f 6e | 2e 20 54 68 61 74 d5 73 |otection|. That.s|
|000002d0| 20 77 68 79 20 77 65 d5 | 76 65 20 69 6e 63 6c 75 | why we.|ve inclu|
|000002e0| 64 65 64 20 74 68 65 20 | 6f 75 74 6c 69 6e 65 20 |ded the |outline |
|000002f0| 66 6f 72 6d 20 6f 66 20 | 74 68 65 20 74 65 63 68 |form of |the tech|
|00000300| 6e 69 63 61 6c 20 6e 6f | 74 65 2e 20 54 68 65 20 |nical no|te. The |
|00000310| 66 69 72 73 74 20 74 77 | 6f 20 70 61 67 65 73 20 |first tw|o pages |
|00000320| 6f 75 74 6c 69 6e 65 20 | 74 68 65 20 70 72 6f 62 |outline |the prob|
|00000330| 6c 65 6d 73 20 61 6e 64 | 20 74 68 65 20 73 6f 6c |lems and| the sol|
|00000340| 75 74 69 6f 6e 73 20 74 | 68 61 74 20 61 72 65 20 |utions t|hat are |
|00000350| 64 65 74 61 69 6c 65 64 | 20 6c 61 74 65 72 2e 20 |detailed| later. |
|00000360| 46 65 65 6c 20 66 72 65 | 65 20 74 6f 20 73 6b 69 |Feel fre|e to ski|
|00000370| 70 20 61 72 6f 75 6e 64 | 20 61 74 20 77 69 6c 6c |p around| at will|
|00000380| 2c 20 62 75 74 20 72 65 | 6d 65 6d 62 65 72 20 74 |, but re|member t|
|00000390| 68 61 74 20 77 65 d5 72 | 65 20 73 65 6e 64 69 6e |hat we.r|e sendin|
|000003a0| 67 20 74 68 69 73 20 65 | 6e 6f 72 6d 6f 75 73 20 |g this e|normous |
|000003b0| 74 65 63 68 6e 69 63 61 | 6c 20 6e 6f 74 65 20 62 |technica|l note b|
|000003c0| 65 63 61 75 73 65 20 74 | 68 65 20 73 75 67 67 65 |ecause t|he sugge|
|000003d0| 73 74 69 6f 6e 73 20 69 | 74 20 70 72 6f 76 69 64 |stions i|t provid|
|000003e0| 65 73 20 6d 61 79 20 73 | 61 76 65 20 79 6f 75 20 |es may s|ave you |
|000003f0| 68 61 73 74 79 20 63 6f | 6d 70 61 74 69 62 69 6c |hasty co|mpatibil|
|00000400| 69 74 79 20 72 65 76 69 | 73 69 6f 6e 73 20 77 68 |ity revi|sions wh|
|00000410| 65 6e 20 77 65 20 61 6e | 6e 6f 75 6e 63 65 20 61 |en we an|nounce a|
|00000420| 20 6e 65 77 20 6d 61 63 | 68 69 6e 65 2e 0d 57 65 | new mac|hine..We|
|00000430| 20 6b 6e 6f 77 20 69 74 | d5 73 20 61 20 6c 6f 74 | know it|.s a lot|
|00000440| 2c 20 61 6e 64 20 77 65 | d5 72 65 20 68 65 72 65 |, and we|.re here|
|00000450| 20 74 6f 20 68 65 6c 70 | 20 79 6f 75 20 69 66 20 | to help| you if |
|00000460| 79 6f 75 20 6e 65 65 64 | 20 69 74 2e 20 4f 75 72 |you need| it. Our|
|00000470| 20 61 64 64 72 65 73 73 | 20 28 65 6c 65 63 74 72 | address| (electr|
|00000480| 6f 6e 69 63 20 61 6e 64 | 20 70 68 79 73 69 63 61 |onic and| physica|
|00000490| 6c 29 20 69 73 20 6f 6e | 20 70 61 67 65 20 74 77 |l) is on| page tw|
|000004a0| 6f d1 63 6f 6e 74 61 63 | 74 20 75 73 20 77 69 74 |o.contac|t us wit|
|000004b0| 68 20 61 6e 79 20 71 75 | 65 73 74 69 6f 6e 73 d1 |h any qu|estions.|
|000004c0| 74 68 61 74 d5 73 20 77 | 68 61 74 20 77 65 d5 72 |that.s w|hat we.r|
|000004d0| 65 20 68 65 72 65 20 66 | 6f 72 21 0d 43 6f 6d 70 |e here f|or!.Comp|
|000004e0| 61 74 69 62 69 6c 69 74 | 79 3a 20 74 68 65 20 6f |atibilit|y: the o|
|000004f0| 75 74 6c 69 6e 65 0d 44 | 6f 6e d5 74 20 61 73 73 |utline.D|on.t ass|
|00000500| 75 6d 65 20 74 68 65 20 | 73 63 72 65 65 6e 20 69 |ume the |screen i|
|00000510| 73 20 61 20 66 69 78 65 | 64 20 73 69 7a 65 0d 54 |s a fixe|d size.T|
|00000520| 6f 20 67 65 74 20 74 68 | 65 20 73 63 72 65 65 6e |o get th|e screen|
|00000530| 20 73 69 7a 65 3a 0d 09 | a5 20 63 68 65 63 6b 20 | size:..|. check |
|00000540| 74 68 65 20 51 75 69 63 | 6b 44 72 61 77 20 67 6c |the Quic|kDraw gl|
|00000550| 6f 62 61 6c 20 73 63 72 | 65 65 6e 42 69 74 73 2e |obal scr|eenBits.|
|00000560| 62 6f 75 6e 64 73 0d 44 | 6f 6e d5 74 20 61 73 73 |bounds.D|on.t ass|
|00000570| 75 6d 65 20 74 68 65 20 | 73 63 72 65 65 6e 20 69 |ume the |screen i|
|00000580| 73 20 69 6e 20 61 20 66 | 69 78 65 64 20 6c 6f 63 |s in a f|ixed loc|
|00000590| 61 74 69 6f 6e 0d 54 6f | 20 67 65 74 20 74 68 65 |ation.To| get the|
|000005a0| 20 73 63 72 65 65 6e 20 | 6c 6f 63 61 74 69 6f 6e | screen |location|
|000005b0| 3a 0d 09 a5 20 63 68 65 | 63 6b 20 74 68 65 20 51 |:... che|ck the Q|
|000005c0| 75 69 63 6b 44 72 61 77 | 20 67 6c 6f 62 61 6c 20 |uickDraw| global |
|000005d0| 73 63 72 65 65 6e 42 69 | 74 73 2e 62 61 73 65 41 |screenBi|ts.baseA|
|000005e0| 64 64 72 0d 44 6f 6e d5 | 74 20 61 73 73 75 6d 65 |ddr.Don.|t assume|
|000005f0| 20 74 68 61 74 20 72 6f | 77 42 79 74 65 73 20 69 | that ro|wBytes i|
|00000600| 73 20 65 71 75 61 6c 20 | 74 6f 20 74 68 65 20 77 |s equal |to the w|
|00000610| 69 64 74 68 20 6f 66 20 | 74 68 65 20 73 63 72 65 |idth of |the scre|
|00000620| 65 6e 0d 54 6f 20 67 65 | 74 20 74 68 65 20 6e 75 |en.To ge|t the nu|
|00000630| 6d 62 65 72 20 6f 66 20 | 62 79 74 65 73 20 6f 6e |mber of |bytes on|
|00000640| 20 61 20 6c 69 6e 65 3a | 0d 09 a5 20 63 68 65 63 | a line:|... chec|
|00000650| 6b 20 74 68 65 20 51 75 | 69 63 6b 44 72 61 77 20 |k the Qu|ickDraw |
|00000660| 67 6c 6f 62 61 6c 20 73 | 63 72 65 65 6e 42 69 74 |global s|creenBit|
|00000670| 73 2e 72 6f 77 42 79 74 | 65 73 0d 54 6f 20 67 65 |s.rowByt|es.To ge|
|00000680| 74 20 74 68 65 20 73 63 | 72 65 65 6e 20 77 69 64 |t the sc|reen wid|
|00000690| 74 68 3a 0d 09 a5 20 63 | 68 65 63 6b 20 74 68 65 |th:... c|heck the|
|000006a0| 20 51 75 69 63 6b 44 72 | 61 77 20 67 6c 6f 62 61 | QuickDr|aw globa|
|000006b0| 6c 20 73 63 72 65 65 6e | 42 69 74 73 2e 62 6f 75 |l screen|Bits.bou|
|000006c0| 6e 64 73 2e 72 69 67 68 | 74 0d 54 6f 20 64 6f 20 |nds.righ|t.To do |
|000006d0| 73 63 72 65 65 6e 2d 73 | 69 7a 65 20 63 61 6c 63 |screen-s|ize calc|
|000006e0| 75 6c 61 74 69 6f 6e 73 | 3a 0d 09 a5 20 55 73 65 |ulations|:... Use|
|000006f0| 20 4c 6f 6e 67 49 6e 74 | 73 0d 44 6f 6e d5 74 20 | LongInt|s.Don.t |
|00000700| 77 72 69 74 65 20 74 6f | 20 6f 72 20 72 65 61 64 |write to| or read|
|00000710| 20 66 72 6f 6d 20 6e 69 | 6c 20 48 61 6e 64 6c 65 | from ni|l Handle|
|00000720| 73 20 6f 72 20 6e 69 6c | 20 50 6f 69 6e 74 65 72 |s or nil| Pointer|
|00000730| 73 0d 44 6f 6e d5 74 20 | 63 72 65 61 74 65 20 6f |s.Don.t |create o|
|00000740| 72 20 55 73 65 20 46 61 | 6b 65 20 48 61 6e 64 6c |r Use Fa|ke Handl|
|00000750| 65 73 0d 54 6f 20 61 76 | 6f 69 64 20 63 72 65 61 |es.To av|oid crea|
|00000760| 74 69 6e 67 20 6f 72 20 | 75 73 69 6e 67 20 66 61 |ting or |using fa|
|00000770| 6b 65 20 68 61 6e 64 6c | 65 73 3a 0d 09 a5 20 41 |ke handl|es:... A|
|00000780| 6c 77 61 79 73 20 6c 65 | 74 20 74 68 65 20 4d 65 |lways le|t the Me|
|00000790| 6d 6f 72 79 20 4d 61 6e | 61 67 65 72 20 70 65 72 |mory Man|ager per|
|000007a0| 66 6f 72 6d 20 6f 70 65 | 72 61 74 69 6f 6e 73 20 |form ope|rations |
|000007b0| 77 69 74 68 20 68 61 6e | 64 6c 65 73 0d 09 a5 20 |with han|dles... |
|000007c0| 4e 65 76 65 72 20 77 72 | 69 74 65 20 63 6f 64 65 |Never wr|ite code|
|000007d0| 20 74 68 61 74 20 61 73 | 73 69 67 6e 73 20 73 6f | that as|signs so|
|000007e0| 6d 65 74 68 69 6e 67 20 | 74 6f 20 61 20 6d 61 73 |mething |to a mas|
|000007f0| 74 65 72 20 70 6f 69 6e | 74 65 72 0d 44 6f 6e d5 |ter poin|ter.Don.|
|00000800| 74 20 77 72 69 74 65 20 | 63 6f 64 65 20 74 68 61 |t write |code tha|
|00000810| 74 20 6d 6f 64 69 66 69 | 65 73 20 69 74 73 65 6c |t modifi|es itsel|
|00000820| 66 0d 53 65 6c 66 20 6d | 6f 64 69 66 79 69 6e 67 |f.Self m|odifying|
|00000830| 20 63 6f 64 65 20 77 69 | 6c 6c 20 6e 6f 74 20 6c | code wi|ll not l|
|00000840| 69 76 65 20 61 63 72 6f | 73 73 20 69 6e 63 61 72 |ive acro|ss incar|
|00000850| 6e 61 74 69 6f 6e 73 20 | 6f 66 20 74 68 65 20 36 |nations |of the 6|
|00000860| 38 30 30 30 0d 54 68 69 | 6e 6b 20 63 61 72 65 66 |8000.Thi|nk caref|
|00000870| 75 6c 6c 79 20 61 62 6f | 75 74 20 63 6f 64 65 20 |ully abo|ut code |
|00000880| 64 65 73 69 67 6e 65 64 | 20 73 74 72 69 63 74 6c |designed| strictl|
|00000890| 79 20 61 73 20 63 6f 70 | 79 20 70 72 6f 74 65 63 |y as cop|y protec|
|000008a0| 74 69 6f 6e 0d 54 6f 20 | 61 76 6f 69 64 20 63 6f |tion.To |avoid co|
|000008b0| 70 79 20 70 72 6f 74 65 | 63 74 69 6f 6e 2d 72 65 |py prote|ction-re|
|000008c0| 6c 61 74 65 64 20 69 6e | 63 6f 6d 70 61 74 69 62 |lated in|compatib|
|000008d0| 69 6c 69 74 69 65 73 3a | 0d 09 a5 20 41 76 6f 69 |ilities:|... Avoi|
|000008e0| 64 20 63 6f 70 79 20 70 | 72 6f 74 65 63 74 69 6f |d copy p|rotectio|
|000008f0| 6e 20 61 6c 74 6f 67 65 | 74 68 65 72 0d 09 a5 20 |n altoge|ther... |
|00000900| 52 65 6c 79 20 6f 6e 20 | 73 63 68 65 6d 65 73 20 |Rely on |schemes |
|00000910| 74 68 61 74 20 64 6f 6e | d5 74 20 72 65 71 75 69 |that don|.t requi|
|00000920| 72 65 20 73 70 65 63 69 | 66 69 63 20 68 61 72 64 |re speci|fic hard|
|00000930| 77 61 72 65 0d 09 a5 20 | 4d 61 6b 65 20 73 75 72 |ware... |Make sur|
|00000940| 65 20 79 6f 75 72 20 73 | 63 68 65 6d 65 20 64 6f |e your s|cheme do|
|00000950| 65 73 6e d5 74 20 70 65 | 72 66 6f 72 6d 20 69 6c |esn.t pe|rform il|
|00000960| 6c 65 67 61 6c 20 6f 70 | 65 72 61 74 69 6f 6e 73 |legal op|erations|
|00000970| 20 0d 44 6f 6e d5 74 20 | 69 67 6e 6f 72 65 20 65 | .Don.t |ignore e|
|00000980| 72 72 6f 72 73 0d 54 6f | 20 67 65 74 20 76 61 6c |rrors.To| get val|
|00000990| 75 61 62 6c 65 20 69 6e | 66 6f 72 6d 61 74 69 6f |uable in|formatio|
|000009a0| 6e 3a 0d 09 a5 20 43 68 | 65 63 6b 20 61 6c 6c 20 |n:... Ch|eck all |
|000009b0| 70 65 72 74 69 6e 65 6e | 74 20 63 61 6c 6c 73 20 |pertinen|t calls |
|000009c0| 66 6f 72 20 65 72 72 6f | 72 73 20 0d 09 a5 20 41 |for erro|rs ... A|
|000009d0| 6c 77 61 79 73 20 77 72 | 69 74 65 20 64 65 66 65 |lways wr|ite defe|
|000009e0| 6e 73 69 76 65 20 63 6f | 64 65 20 0d 44 6f 6e d5 |nsive co|de .Don.|
|000009f0| 74 20 61 63 63 65 73 73 | 20 68 61 72 64 77 61 72 |t access| hardwar|
|00000a00| 65 20 64 69 72 65 63 74 | 6c 79 0d 54 6f 20 61 76 |e direct|ly.To av|
|00000a10| 6f 69 64 20 68 61 72 64 | 77 61 72 65 2d 72 65 6c |oid hard|ware-rel|
|00000a20| 61 74 65 64 20 69 6e 63 | 6f 6d 70 61 74 69 62 69 |ated inc|ompatibi|
|00000a30| 6c 69 74 69 65 73 3a 0d | 09 a5 20 44 6f 6e d5 74 |lities:.|.. Don.t|
|00000a40| 20 72 65 61 64 20 6f 72 | 20 77 72 69 74 65 20 74 | read or| write t|
|00000a50| 68 65 20 68 61 72 64 77 | 61 72 65 0d 09 a5 20 49 |he hardw|are... I|
|00000a60| 66 20 79 6f 75 20 63 61 | 6e d5 74 20 67 65 74 20 |f you ca|n.t get |
|00000a70| 74 68 65 20 73 75 70 70 | 6f 72 74 20 66 72 6f 6d |the supp|ort from|
|00000a80| 20 74 68 65 20 52 4f 4d | 2c 20 61 73 6b 20 74 68 | the ROM|, ask th|
|00000a90| 65 20 73 79 73 74 65 6d | 20 77 68 65 72 65 20 74 |e system| where t|
|00000aa0| 68 65 20 68 61 72 64 77 | 61 72 65 20 69 73 0d 09 |he hardw|are is..|
|00000ab0| a5 20 55 73 65 20 6c 6f | 77 2d 6d 65 6d 6f 72 79 |. Use lo|w-memory|
|00000ac0| 20 67 6c 6f 62 61 6c 73 | 0d 44 6f 6e d5 74 20 75 | globals|.Don.t u|
|00000ad0| 73 65 20 62 69 74 73 20 | 74 68 61 74 20 61 72 65 |se bits |that are|
|00000ae0| 20 72 65 73 65 72 76 65 | 64 0d 54 6f 20 61 76 6f | reserve|d.To avo|
|00000af0| 69 64 20 63 6f 6d 70 61 | 74 69 62 69 6c 69 74 79 |id compa|tibility|
|00000b00| 20 70 72 6f 62 6c 65 6d | 73 20 77 68 65 6e 20 62 | problem|s when b|
|00000b10| 69 74 20 73 74 61 74 75 | 73 20 63 68 61 6e 67 65 |it statu|s change|
|00000b20| 73 3a 0d 09 a5 20 44 6f | 6e d5 74 20 75 73 65 20 |s:... Do|n.t use |
|00000b30| 75 6e 64 6f 63 75 6d 65 | 6e 74 65 64 20 73 74 75 |undocume|nted stu|
|00000b40| 66 66 0d 09 a5 20 57 68 | 65 6e 20 75 73 69 6e 67 |ff... Wh|en using|
|00000b50| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 67 6c 6f 62 | low-mem|ory glob|
|00000b60| 61 6c 73 2c 20 63 68 65 | 63 6b 20 6f 6e 6c 79 20 |als, che|ck only |
|00000b70| 77 68 61 74 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |what you| want to|
|00000b80| 20 6b 6e 6f 77 0d 53 75 | 6d 6d 61 72 79 0d 4d 69 | know.Su|mmary.Mi|
|00000b90| 6e 6f 72 20 62 75 67 73 | 20 61 72 65 20 67 65 74 |nor bugs| are get|
|00000ba0| 74 69 6e 67 20 68 61 72 | 64 65 72 20 61 6e 64 20 |ting har|der and |
|00000bb0| 68 61 72 64 65 72 20 74 | 6f 20 67 65 74 20 61 77 |harder t|o get aw|
|00000bc0| 61 79 20 77 69 74 68 3a | 0d 09 a5 20 47 6f 6f 64 |ay with:|... Good|
|00000bd0| 20 6c 75 63 6b 0d 09 a5 | 20 57 65 d5 6c 6c 20 68 | luck...| We.ll h|
|00000be0| 65 6c 70 0d 09 a5 20 41 | 70 70 6c 65 4c 69 6e 6b |elp... A|ppleLink|
|00000bf0| 3a 20 4d 61 63 44 54 53 | 2c 20 4d 43 49 3a 20 4d |: MacDTS|, MCI: M|
|00000c00| 61 63 44 54 53 0d 09 a5 | 20 55 2e 53 2e 20 4d 61 |acDTS...| U.S. Ma|
|00000c10| 69 6c 3a 20 32 30 35 32 | 35 20 4d 61 72 69 61 6e |il: 2052|5 Marian|
|00000c20| 69 20 41 76 65 2e 3b 20 | 4d 2f 53 20 32 37 2d 54 |i Ave.; |M/S 27-T|
|00000c30| 3b 20 43 75 70 65 72 74 | 69 6e 6f 2c 20 43 41 20 |; Cupert|ino, CA |
|00000c40| 39 35 30 31 34 0d 57 68 | 61 74 20 69 74 20 49 73 |95014.Wh|at it Is|
|00000c50| 0d 54 68 65 20 62 61 73 | 69 63 20 69 64 65 61 20 |.The bas|ic idea |
|00000c60| 69 73 20 74 6f 20 6d 61 | 6b 65 20 73 75 72 65 20 |is to ma|ke sure |
|00000c70| 74 68 61 74 20 79 6f 75 | 72 20 70 72 6f 67 72 61 |that you|r progra|
|00000c80| 6d 73 20 77 69 6c 6c 20 | 72 75 6e 2c 20 72 65 67 |ms will |run, reg|
|00000c90| 61 72 64 6c 65 73 73 20 | 6f 66 20 77 68 69 63 68 |ardless |of which|
|00000ca0| 20 4d 61 63 69 6e 74 6f | 73 68 20 74 68 65 79 20 | Macinto|sh they |
|00000cb0| 61 72 65 20 62 65 69 6e | 67 20 72 75 6e 20 6f 6e |are bein|g run on|
|00000cc0| 2e 20 54 68 65 20 63 75 | 72 72 65 6e 74 20 73 79 |. The cu|rrent sy|
|00000cd0| 73 74 65 6d 73 20 74 6f | 20 62 65 20 63 6f 6e 63 |stems to| be conc|
|00000ce0| 65 72 6e 65 64 20 77 69 | 74 68 20 69 6e 63 6c 75 |erned wi|th inclu|
|00000cf0| 64 65 3a 0d 09 a5 20 4d | 61 63 69 6e 74 6f 73 68 |de:... M|acintosh|
|00000d00| 20 31 32 38 4b 09 a5 20 | 4d 61 63 69 6e 74 6f 73 | 128K.. |Macintos|
|00000d10| 68 20 35 31 32 4b 65 0d | 09 a5 20 4d 61 63 69 6e |h 512Ke.|.. Macin|
|00000d20| 74 6f 73 68 20 35 31 32 | 4b 09 a5 20 4d 61 63 69 |tosh 512|K.. Maci|
|00000d30| 6e 74 6f 73 68 20 50 6c | 75 73 0d 09 a5 20 4d 61 |ntosh Pl|us... Ma|
|00000d40| 63 69 6e 74 6f 73 68 20 | 58 4c 09 a5 20 4d 61 63 |cintosh |XL.. Mac|
|00000d50| 69 6e 74 6f 73 68 20 53 | 45 0d 09 a5 20 4d 61 63 |intosh S|E... Mac|
|00000d60| 69 6e 74 6f 73 68 20 49 | 49 0d 49 66 20 79 6f 75 |intosh I|I.If you|
|00000d70| 20 70 65 72 66 6f 72 6d | 20 6f 70 65 72 61 74 69 | perform| operati|
|00000d80| 6f 6e 73 20 69 6e 20 61 | 20 67 65 6e 65 72 69 63 |ons in a| generic|
|00000d90| 20 66 61 73 68 69 6f 6e | 2c 20 74 68 65 72 65 20 | fashion|, there |
|00000da0| 69 73 20 72 61 72 65 6c | 79 20 61 6e 79 20 72 65 |is rarel|y any re|
|00000db0| 61 73 6f 6e 20 74 6f 20 | 6b 6e 6f 77 20 77 68 61 |ason to |know wha|
|00000dc0| 74 20 6d 61 63 68 69 6e | 65 20 69 73 20 72 75 6e |t machin|e is run|
|00000dd0| 6e 69 6e 67 2e 20 54 68 | 69 73 20 6d 65 61 6e 73 |ning. Th|is means|
|00000de0| 20 74 68 61 74 20 79 6f | 75 20 73 68 6f 75 6c 64 | that yo|u should|
|00000df0| 20 61 76 6f 69 64 20 77 | 72 69 74 69 6e 67 20 63 | avoid w|riting c|
|00000e00| 6f 64 65 20 74 6f 20 64 | 65 74 65 72 6d 69 6e 65 |ode to d|etermine|
|00000e10| 20 77 68 69 63 68 20 76 | 65 72 73 69 6f 6e 20 6f | which v|ersion o|
|00000e20| 66 20 74 68 65 20 6d 61 | 63 68 69 6e 65 20 79 6f |f the ma|chine yo|
|00000e30| 75 20 61 72 65 20 72 75 | 6e 6e 69 6e 67 20 6f 6e |u are ru|nning on|
|00000e40| 2c 20 75 6e 6c 65 73 73 | 20 69 74 20 69 73 20 61 |, unless| it is a|
|00000e50| 62 73 6f 6c 75 74 65 6c | 79 20 6e 65 63 65 73 73 |bsolutel|y necess|
|00000e60| 61 72 79 2e 0d 46 6f 72 | 20 74 68 65 20 70 75 72 |ary..For| the pur|
|00000e70| 70 6f 73 65 73 20 6f 66 | 20 74 68 69 73 20 64 69 |poses of| this di|
|00000e80| 73 63 75 73 73 69 6f 6e | 2c 20 74 68 65 20 74 65 |scussion|, the te|
|00000e90| 72 6d 20 d2 70 72 6f 67 | 72 61 6d 73 d3 20 77 69 |rm .prog|rams. wi|
|00000ea0| 6c 6c 20 62 65 20 75 73 | 65 64 20 74 6f 20 64 65 |ll be us|ed to de|
|00000eb0| 73 63 72 69 62 65 20 61 | 6e 79 20 63 6f 64 65 20 |scribe a|ny code |
|00000ec0| 74 68 61 74 20 72 75 6e | 73 20 6f 6e 20 61 20 4d |that run|s on a M|
|00000ed0| 61 63 69 6e 74 6f 73 68 | 2e 20 54 68 69 73 20 69 |acintosh|. This i|
|00000ee0| 6e 63 6c 75 64 65 73 20 | 61 70 70 6c 69 63 61 74 |ncludes |applicat|
|00000ef0| 69 6f 6e 73 2c 20 49 4e | 49 54 73 2c 20 46 4b 45 |ions, IN|ITs, FKE|
|00000f00| 59 73 2c 20 44 65 73 6b | 20 41 63 63 65 73 73 6f |Ys, Desk| Accesso|
|00000f10| 72 69 65 73 20 61 6e 64 | 20 44 72 69 76 65 72 73 |ries and| Drivers|
|00000f20| 2e 0d 57 68 61 74 20 74 | 68 65 20 d2 52 75 6c 65 |..What t|he .Rule|
|00000f30| 73 d3 20 6d 65 61 6e 0d | 43 6f 6d 70 61 74 69 62 |s. mean.|Compatib|
|00000f40| 69 6c 69 74 79 20 61 63 | 72 6f 73 73 20 61 6c 6c |ility ac|ross all|
|00000f50| 20 4d 61 63 69 6e 74 6f | 73 68 20 63 6f 6d 70 75 | Macinto|sh compu|
|00000f60| 74 65 72 73 20 28 77 68 | 69 63 68 20 6d 61 79 20 |ters (wh|ich may |
|00000f70| 73 6f 75 6e 64 20 6c 69 | 6b 65 20 69 74 20 69 6e |sound li|ke it in|
|00000f80| 76 6f 6c 76 65 73 20 6d | 6f 72 65 20 77 6f 72 6b |volves m|ore work|
|00000f90| 20 66 6f 72 20 79 6f 75 | 29 20 6d 61 79 20 61 63 | for you|) may ac|
|00000fa0| 74 75 61 6c 6c 79 20 6d | 65 61 6e 20 74 68 61 74 |tually m|ean that|
|00000fb0| 20 79 6f 75 20 68 61 76 | 65 20 6c 65 73 73 20 77 | you hav|e less w|
|00000fc0| 6f 72 6b 20 74 6f 20 64 | 6f 2c 20 73 69 6e 63 65 |ork to d|o, since|
|00000fd0| 20 69 74 20 6d 61 79 20 | 6e 6f 74 20 62 65 20 6e | it may |not be n|
|00000fe0| 65 63 65 73 73 61 72 79 | 20 74 6f 20 72 65 76 69 |ecessary| to revi|
|00000ff0| 73 65 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 20 |se your |program |
|00001000| 65 61 63 68 20 74 69 6d | 65 20 41 70 70 6c 65 20 |each tim|e Apple |
|00001010| 62 72 69 6e 67 73 20 6f | 75 74 20 61 20 6e 65 77 |brings o|ut a new|
|00001020| 20 63 6f 6d 70 75 74 65 | 72 20 6f 72 20 53 79 73 | compute|r or Sys|
|00001030| 74 65 6d 20 66 69 6c 65 | 2e 20 55 73 65 72 73 2c |tem file|. Users,|
|00001040| 20 61 73 20 61 20 67 72 | 6f 75 70 2c 20 64 6f 20 | as a gr|oup, do |
|00001050| 6e 6f 74 20 75 6e 64 65 | 72 73 74 61 6e 64 20 63 |not unde|rstand c|
|00001060| 6f 6d 70 61 74 69 62 69 | 6c 69 74 79 20 70 72 6f |ompatibi|lity pro|
|00001070| 62 6c 65 6d 73 3b 20 61 | 6c 6c 20 74 68 65 79 20 |blems; a|ll they |
|00001080| 73 65 65 20 69 73 20 74 | 68 61 74 20 74 68 65 20 |see is t|hat the |
|00001090| 70 72 6f 67 72 61 6d 20 | 64 6f 65 73 20 6e 6f 74 |program |does not|
|000010a0| 20 72 75 6e 20 6f 6e 20 | 74 68 65 69 72 20 73 79 | run on |their sy|
|000010b0| 73 74 65 6d 2e 0d 54 68 | 65 20 62 65 6e 65 66 69 |stem..Th|e benefi|
|000010c0| 74 73 20 6f 66 20 62 65 | 69 6e 67 20 63 6f 6d 70 |ts of be|ing comp|
|000010d0| 61 74 69 62 6c 65 20 61 | 72 65 20 6d 61 6e 79 2d |atible a|re many-|
|000010e0| 66 6f 6c 64 3a 20 79 6f | 75 72 20 63 75 73 74 6f |fold: yo|ur custo|
|000010f0| 6d 65 72 73 2f 75 73 65 | 72 73 20 73 74 61 79 20 |mers/use|rs stay |
|00001100| 68 61 70 70 79 2c 20 79 | 6f 75 20 68 61 76 65 20 |happy, y|ou have |
|00001110| 6c 65 73 73 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |less pro|gramming|
|00001120| 20 74 6f 20 64 6f 2c 20 | 79 6f 75 20 63 61 6e 20 | to do, |you can |
|00001130| 64 65 76 6f 74 65 20 79 | 6f 75 72 20 74 69 6d 65 |devote y|our time|
|00001140| 20 74 6f 20 6d 6f 72 65 | 20 76 61 6c 75 61 62 6c | to more| valuabl|
|00001150| 65 20 67 6f 61 6c 73 2c | 20 74 68 65 72 65 20 61 |e goals,| there a|
|00001160| 72 65 20 66 65 77 65 72 | 20 76 65 72 73 69 6f 6e |re fewer| version|
|00001170| 73 20 74 6f 20 64 65 61 | 6c 20 77 69 74 68 2c 20 |s to dea|l with, |
|00001180| 79 6f 75 72 20 63 6f 64 | 65 20 77 69 6c 6c 20 70 |your cod|e will p|
|00001190| 72 6f 62 61 62 6c 79 20 | 62 65 20 6d 6f 72 65 20 |robably |be more |
|000011a0| 65 66 66 69 63 69 65 6e | 74 2c 20 79 6f 75 72 20 |efficien|t, your |
|000011b0| 75 73 65 72 73 20 77 69 | 6c 6c 20 6e 6f 74 20 63 |users wi|ll not c|
|000011c0| 75 72 73 65 20 79 6f 75 | 20 75 6e 64 65 72 20 74 |urse you| under t|
|000011d0| 68 65 69 72 20 62 72 65 | 61 74 68 2c 20 61 6e 64 |heir bre|ath, and|
|000011e0| 20 79 6f 75 72 20 6f 75 | 74 6c 6f 6f 6b 20 6f 6e | your ou|tlook on|
|000011f0| 20 6c 69 66 65 20 77 69 | 6c 6c 20 62 65 20 6d 75 | life wi|ll be mu|
|00001200| 63 68 20 6d 65 72 72 69 | 65 72 2e 0d 4e 6f 77 20 |ch merri|er..Now |
|00001210| 74 68 61 74 20 77 65 20 | 6b 6e 6f 77 20 77 68 61 |that we |know wha|
|00001220| 74 20 62 65 69 6e 67 20 | 63 6f 6d 70 61 74 69 62 |t being |compatib|
|00001230| 6c 65 20 69 73 20 61 6c | 6c 20 61 62 6f 75 74 2c |le is al|l about,|
|00001240| 20 72 65 63 6f 67 6e 69 | 7a 65 20 74 68 61 74 20 | recogni|ze that |
|00001250| 6e 6f 62 6f 64 79 20 69 | 73 20 72 65 71 75 69 72 |nobody i|s requir|
|00001260| 69 6e 67 20 79 6f 75 20 | 74 6f 20 62 65 20 63 6f |ing you |to be co|
|00001270| 6d 70 61 74 69 62 6c 65 | 20 77 69 74 68 20 61 6e |mpatible| with an|
|00001280| 79 74 68 69 6e 67 2e 20 | 41 70 70 6c 65 20 64 6f |ything. |Apple do|
|00001290| 65 73 20 6e 6f 74 20 65 | 6d 70 6c 6f 79 20 72 6f |es not e|mploy ro|
|000012a0| 76 69 6e 67 20 67 61 6e | 67 73 20 6f 66 20 74 68 |ving gan|gs of th|
|000012b0| 6f 75 67 68 74 20 70 6f | 6c 69 63 65 20 74 6f 20 |ought po|lice to |
|000012c0| 62 65 20 73 75 72 65 20 | 74 68 61 74 20 64 65 76 |be sure |that dev|
|000012d0| 65 6c 6f 70 65 72 73 20 | 61 72 65 20 66 6f 6c 6c |elopers |are foll|
|000012e0| 6f 77 69 6e 67 20 74 68 | 65 20 72 65 63 6f 6d 6d |owing th|e recomm|
|000012f0| 65 6e 64 65 64 20 67 75 | 69 64 65 6c 69 6e 65 73 |ended gu|idelines|
|00001300| 2e 20 46 75 72 74 68 65 | 72 6d 6f 72 65 2c 20 77 |. Furthe|rmore, w|
|00001310| 68 65 6e 20 74 68 65 20 | 67 75 69 64 65 6c 69 6e |hen the |guidelin|
|00001320| 65 73 20 63 6f 6d 70 72 | 69 73 65 20 31 32 30 30 |es compr|ise 1200|
|00001330| 20 70 61 67 65 73 20 6f | 66 20 74 75 72 67 69 64 | pages o|f turgid|
|00001340| 20 70 72 6f 73 65 20 28 | 49 6e 73 69 64 65 20 4d | prose (|Inside M|
|00001350| 61 63 69 6e 74 6f 73 68 | 29 2c 20 79 6f 75 20 63 |acintosh|), you c|
|00001360| 61 6e 20 62 65 20 65 78 | 70 65 63 74 65 64 20 74 |an be ex|pected t|
|00001370| 6f 20 6d 69 73 73 20 6f | 6e 65 20 6f 72 20 74 77 |o miss o|ne or tw|
|00001380| 6f 20 6f 66 20 74 68 65 | 20 d2 72 75 6c 65 73 2e |o of the| .rules.|
|00001390| d3 20 49 74 20 69 73 20 | 6e 6f 20 73 69 6e 20 74 |. It is |no sin t|
|000013a0| 6f 20 62 65 20 69 6e 63 | 6f 6d 70 61 74 69 62 6c |o be inc|ompatibl|
|000013b0| 65 2c 20 6e 6f 72 20 69 | 73 20 69 74 20 61 20 70 |e, nor i|s it a p|
|000013c0| 75 6e 69 73 68 61 62 6c | 65 20 6f 66 66 65 6e 73 |unishabl|e offens|
|000013d0| 65 2e 20 49 66 20 69 74 | 20 77 65 72 65 2c 20 74 |e. If it| were, t|
|000013e0| 68 65 72 65 20 77 6f 75 | 6c 64 20 62 65 20 6e 6f |here wou|ld be no|
|000013f0| 20 4d 61 63 69 6e 74 6f | 73 68 20 70 72 6f 67 72 | Macinto|sh progr|
|00001400| 61 6d 73 2c 20 73 69 6e | 63 65 20 76 69 72 74 75 |ams, sin|ce virtu|
|00001410| 61 6c 6c 79 20 61 6c 6c | 20 64 65 76 65 6c 6f 70 |ally all| develop|
|00001420| 65 72 73 20 77 6f 75 6c | 64 20 62 65 20 69 6e 63 |ers woul|d be inc|
|00001430| 61 72 63 65 72 61 74 65 | 64 2e 20 57 68 61 74 20 |arcerate|d. What |
|00001440| 69 74 20 64 6f 65 73 20 | 6d 65 61 6e 2c 20 68 6f |it does |mean, ho|
|00001450| 77 65 76 65 72 2c 20 69 | 73 20 74 68 61 74 20 79 |wever, i|s that y|
|00001460| 6f 75 72 20 70 72 6f 67 | 72 61 6d 20 77 69 6c 6c |our prog|ram will|
|00001470| 20 62 65 20 75 6e 66 61 | 76 6f 72 61 62 6c 79 20 | be unfa|vorably |
|00001480| 76 69 65 77 65 64 20 75 | 6e 74 69 6c 20 69 74 20 |viewed u|ntil it |
|00001490| 73 74 65 70 73 20 69 6e | 20 6c 69 6e 65 20 77 69 |steps in| line wi|
|000014a0| 74 68 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 73 |th the c|urrent s|
|000014b0| 79 73 74 65 6d 20 28 77 | 68 69 63 68 20 69 73 20 |ystem (w|hich is |
|000014c0| 61 20 6d 6f 76 69 6e 67 | 20 74 61 72 67 65 74 29 |a moving| target)|
|000014d0| 2e 20 49 66 20 61 20 70 | 72 6f 67 72 61 6d 20 62 |. If a p|rogram b|
|000014e0| 65 63 6f 6d 65 73 20 69 | 6e 63 6f 6d 70 61 74 69 |ecomes i|ncompati|
|000014f0| 62 6c 65 20 77 69 74 68 | 20 61 20 6e 65 77 20 4d |ble with| a new M|
|00001500| 61 63 69 6e 74 6f 73 68 | 2c 20 69 74 20 75 73 75 |acintosh|, it usu|
|00001510| 61 6c 6c 79 20 72 65 71 | 75 69 72 65 73 20 72 65 |ally req|uires re|
|00001520| 74 68 69 6e 6b 69 6e 67 | 20 74 68 65 20 6f 66 66 |thinking| the off|
|00001530| 65 6e 64 69 6e 67 20 63 | 6f 64 65 2c 20 61 6e 64 |ending c|ode, and|
|00001540| 20 72 65 6c 65 61 73 69 | 6e 67 20 61 20 6e 65 77 | releasi|ng a new|
|00001550| 20 76 65 72 73 69 6f 6e | 2e 20 59 6f 75 20 6d 61 | version|. You ma|
|00001560| 79 20 72 65 61 64 20 73 | 6f 6d 65 74 68 69 6e 67 |y read s|omething|
|00001570| 20 6c 69 6b 65 20 d2 49 | 66 20 74 68 65 20 64 65 | like .I|f the de|
|00001580| 76 65 6c 6f 70 65 72 73 | 20 66 6f 6c 6c 6f 77 65 |velopers| followe|
|00001590| 64 20 41 70 70 6c 65 20 | 67 75 69 64 65 6c 69 6e |d Apple |guidelin|
|000015a0| 65 73 2c 20 74 68 65 79 | 20 77 6f 75 6c 64 20 62 |es, they| would b|
|000015b0| 65 20 63 6f 6d 70 61 74 | 69 62 6c 65 20 77 69 74 |e compat|ible wit|
|000015c0| 68 20 74 68 65 20 74 72 | 61 6e 73 76 65 72 73 65 |h the tr|ansverse|
|000015d0| 2d 68 69 6e 67 65 64 20 | 64 69 61 74 6f 6d 69 63 |-hinged |diatomic|
|000015e0| 20 71 75 61 72 6b 20 72 | 65 61 6c 69 67 6e 6d 65 | quark r|ealignme|
|000015f0| 6e 74 20 73 79 73 74 65 | 6d 2e d3 20 54 68 69 73 |nt syste|m.. This|
|00001600| 20 6d 65 61 6e 73 20 74 | 68 61 74 20 69 66 20 79 | means t|hat if y|
|00001610| 6f 75 20 6d 61 64 65 20 | 61 6e 79 20 6d 69 73 74 |ou made |any mist|
|00001620| 61 6b 65 73 20 28 79 6f | 75 20 72 65 61 64 20 61 |akes (yo|u read a|
|00001630| 6c 6c 20 31 32 30 30 20 | 70 61 67 65 73 20 63 61 |ll 1200 |pages ca|
|00001640| 72 65 66 75 6c 6c 79 2c | 20 72 69 67 68 74 3f 29 |refully,| right?)|
|00001650| 2c 20 79 6f 75 20 77 69 | 6c 6c 20 6e 6f 74 20 62 |, you wi|ll not b|
|00001660| 65 20 63 6f 6d 70 61 74 | 69 62 6c 65 2e 20 49 74 |e compat|ible. It|
|00001670| 20 69 73 20 65 78 74 72 | 65 6d 65 6c 79 20 64 69 | is extr|emely di|
|00001680| 66 66 69 63 75 6c 74 20 | 74 6f 20 72 65 6d 61 69 |fficult |to remai|
|00001690| 6e 20 63 6f 6d 70 6c 65 | 74 65 6c 79 20 63 6f 6d |n comple|tely com|
|000016a0| 70 61 74 69 62 6c 65 2c | 20 70 61 72 74 69 63 75 |patible,| particu|
|000016b0| 6c 61 72 6c 79 20 69 6e | 20 61 20 73 79 73 74 65 |larly in| a syste|
|000016c0| 6d 20 61 73 20 63 6f 6d | 70 6c 65 78 20 61 73 20 |m as com|plex as |
|000016d0| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 2e 20 54 |the Maci|ntosh. T|
|000016e0| 68 65 20 72 75 6c 65 73 | 20 68 61 76 65 6e d5 74 |he rules| haven.t|
|000016f0| 20 63 68 61 6e 67 65 64 | 2c 20 62 75 74 20 77 68 | changed|, but wh|
|00001700| 61 74 20 79 6f 75 20 63 | 61 6e 20 67 65 74 20 61 |at you c|an get a|
|00001710| 77 61 79 20 77 69 74 68 | 20 68 61 73 2e 20 54 68 |way with| has. Th|
|00001720| 65 72 65 20 61 72 65 2c | 20 68 6f 77 65 76 65 72 |ere are,| however|
|00001730| 2c 20 61 20 6e 75 6d 62 | 65 72 20 6f 66 20 74 68 |, a numb|er of th|
|00001740| 69 6e 67 73 20 74 68 61 | 74 20 79 6f 75 20 63 61 |ings tha|t you ca|
|00001750| 6e 20 64 6f 20 74 6f 20 | 69 6d 70 72 6f 76 65 20 |n do to |improve |
|00001760| 79 6f 75 72 20 6f 64 64 | 73 d1 73 6f 6d 65 20 6f |your odd|s.some o|
|00001770| 66 20 77 68 69 63 68 20 | 77 69 6c 6c 20 62 65 20 |f which |will be |
|00001780| 65 78 70 6c 61 69 6e 65 | 64 20 68 65 72 65 2e 0d |explaine|d here..|
|00001790| 49 74 d5 73 20 79 6f 75 | 72 20 63 68 6f 69 63 65 |It.s you|r choice|
|000017a0| 0d 49 74 20 69 73 20 73 | 74 69 6c 6c 20 79 6f 75 |.It is s|till you|
|000017b0| 72 20 63 68 6f 69 63 65 | 20 77 68 65 74 68 65 72 |r choice| whether|
|000017c0| 20 79 6f 75 20 77 69 6c | 6c 20 62 65 20 63 6f 6e | you wil|l be con|
|000017d0| 63 65 72 6e 65 64 20 77 | 69 74 68 20 63 6f 6d 70 |cerned w|ith comp|
|000017e0| 61 74 69 62 69 6c 69 74 | 79 20 6f 72 20 6e 6f 74 |atibilit|y or not|
|000017f0| 2e 20 41 70 70 6c 65 20 | 77 69 6c 6c 20 6e 6f 74 |. Apple |will not|
|00001800| 20 70 75 74 20 6f 75 74 | 20 61 20 77 61 72 72 61 | put out| a warra|
|00001810| 6e 74 20 66 6f 72 20 79 | 6f 75 72 20 61 72 72 65 |nt for y|our arre|
|00001820| 73 74 2e 20 48 6f 77 65 | 76 65 72 2c 20 69 66 20 |st. Howe|ver, if |
|00001830| 79 6f 75 20 61 72 65 20 | 64 6f 69 6e 67 20 74 68 |you are |doing th|
|00001840| 69 6e 67 73 20 74 68 61 | 74 20 61 72 65 20 73 70 |ings tha|t are sp|
|00001850| 65 63 69 66 69 63 61 6c | 6c 79 20 69 6c 6c 65 67 |ecifical|ly illeg|
|00001860| 61 6c 2c 20 41 70 70 6c | 65 20 77 69 6c 6c 20 61 |al, Appl|e will a|
|00001870| 6c 73 6f 20 6e 6f 74 20 | 77 6f 72 72 79 20 61 62 |lso not |worry ab|
|00001880| 6f 75 74 20 d2 62 72 65 | 61 6b 69 6e 67 d3 20 79 |out .bre|aking. y|
|00001890| 6f 75 72 20 70 72 6f 67 | 72 61 6d 2e 0d 42 61 64 |our prog|ram..Bad|
|000018a0| 20 54 68 69 6e 67 73 0d | 54 68 65 20 66 6f 6c 6c | Things.|The foll|
|000018b0| 6f 77 69 6e 67 20 6c 69 | 73 74 20 69 73 20 6e 6f |owing li|st is no|
|000018c0| 74 20 69 6e 74 65 6e 64 | 65 64 20 74 6f 20 62 65 |t intend|ed to be|
|000018d0| 20 63 6f 6d 70 72 65 68 | 65 6e 73 69 76 65 2c 20 | compreh|ensive, |
|000018e0| 62 75 74 20 74 68 65 73 | 65 20 61 72 65 20 74 68 |but thes|e are th|
|000018f0| 65 20 70 72 69 6d 61 72 | 79 20 72 65 61 73 6f 6e |e primar|y reason|
|00001900| 73 20 77 68 79 20 70 72 | 6f 67 72 61 6d 73 20 62 |s why pr|ograms b|
|00001910| 72 65 61 6b 20 66 72 6f | 6d 20 6f 6e 65 20 76 65 |reak fro|m one ve|
|00001920| 72 73 69 6f 6e 20 6f 66 | 20 74 68 65 20 73 79 73 |rsion of| the sys|
|00001930| 74 65 6d 20 74 6f 20 74 | 68 65 20 6e 65 78 74 2e |tem to t|he next.|
|00001940| 20 54 68 65 73 65 20 61 | 72 65 20 74 68 65 20 63 | These a|re the c|
|00001950| 75 72 72 65 6e 74 20 74 | 6f 70 20 74 65 6e 20 63 |urrent t|op ten c|
|00001960| 6f 6d 6d 61 6e 64 6d 65 | 6e 74 73 3a 0d 49 09 54 |ommandme|nts:.I.T|
|00001970| 68 6f 75 20 73 68 61 6c | 74 20 6e 6f 74 20 61 73 |hou shal|t not as|
|00001980| 73 75 6d 65 20 74 68 65 | 20 73 63 72 65 65 6e 20 |sume the| screen |
|00001990| 69 73 20 61 20 66 69 78 | 65 64 20 73 69 7a 65 2e |is a fix|ed size.|
|000019a0| 0d 49 49 09 54 68 6f 75 | 20 73 68 61 6c 74 20 6e |.II.Thou| shalt n|
|000019b0| 6f 74 20 61 73 73 75 6d | 65 20 74 68 65 20 73 63 |ot assum|e the sc|
|000019c0| 72 65 65 6e 20 69 73 20 | 61 74 20 61 20 66 69 78 |reen is |at a fix|
|000019d0| 65 64 20 6c 6f 63 61 74 | 69 6f 6e 2e 0d 49 49 49 |ed locat|ion..III|
|000019e0| 09 54 68 6f 75 20 73 68 | 61 6c 74 20 6e 6f 74 20 |.Thou sh|alt not |
|000019f0| 61 73 73 75 6d 65 20 74 | 68 61 74 20 72 6f 77 42 |assume t|hat rowB|
|00001a00| 79 74 65 73 20 69 73 20 | 65 71 75 61 6c 20 74 6f |ytes is |equal to|
|00001a10| 20 74 68 65 20 77 69 64 | 74 68 20 6f 66 20 74 68 | the wid|th of th|
|00001a20| 65 20 73 63 72 65 65 6e | 2e 0d 49 56 09 54 68 6f |e screen|..IV.Tho|
|00001a30| 75 20 73 68 61 6c 74 20 | 6e 6f 74 20 75 73 65 20 |u shalt |not use |
|00001a40| 6e 69 6c 20 68 61 6e 64 | 6c 65 73 20 6f 72 20 6e |nil hand|les or n|
|00001a50| 69 6c 20 70 6f 69 6e 74 | 65 72 73 2e 0d 56 09 54 |il point|ers..V.T|
|00001a60| 68 6f 75 20 73 68 61 6c | 74 20 6e 6f 74 20 63 72 |hou shal|t not cr|
|00001a70| 65 61 74 65 20 6f 72 20 | 75 73 65 20 66 61 6b 65 |eate or |use fake|
|00001a80| 20 68 61 6e 64 6c 65 73 | 2e 0d 56 49 09 54 68 6f | handles|..VI.Tho|
|00001a90| 75 20 73 68 61 6c 74 20 | 6e 6f 74 20 77 72 69 74 |u shalt |not writ|
|00001aa0| 65 20 63 6f 64 65 20 74 | 68 61 74 20 6d 6f 64 69 |e code t|hat modi|
|00001ab0| 66 69 65 73 20 69 74 73 | 65 6c 66 2e 0d 56 49 49 |fies its|elf..VII|
|00001ac0| 09 54 68 6f 75 20 73 68 | 61 6c 74 20 74 68 69 6e |.Thou sh|alt thin|
|00001ad0| 6b 20 74 77 69 63 65 20 | 61 62 6f 75 74 20 63 6f |k twice |about co|
|00001ae0| 64 65 20 64 65 73 69 67 | 6e 65 64 20 73 74 72 69 |de desig|ned stri|
|00001af0| 63 74 6c 79 20 61 73 20 | 63 6f 70 79 20 70 72 6f |ctly as |copy pro|
|00001b00| 74 65 63 74 69 6f 6e 2e | 0d 56 49 49 49 09 54 68 |tection.|.VIII.Th|
|00001b10| 6f 75 20 73 68 61 6c 74 | 20 63 68 65 63 6b 20 65 |ou shalt| check e|
|00001b20| 72 72 6f 72 73 20 72 65 | 74 75 72 6e 65 64 20 61 |rrors re|turned a|
|00001b30| 73 20 66 75 6e 63 74 69 | 6f 6e 20 72 65 73 75 6c |s functi|on resul|
|00001b40| 74 73 2e 0d 49 58 09 54 | 68 6f 75 20 73 68 61 6c |ts..IX.T|hou shal|
|00001b50| 74 20 6e 6f 74 20 61 63 | 63 65 73 73 20 68 61 72 |t not ac|cess har|
|00001b60| 64 77 61 72 65 20 64 69 | 72 65 63 74 6c 79 2e 0d |dware di|rectly..|
|00001b70| 58 09 54 68 6f 75 20 73 | 68 61 6c 74 20 6e 6f 74 |X.Thou s|halt not|
|00001b80| 20 75 73 65 20 61 6e 79 | 20 6f 66 20 74 68 65 20 | use any| of the |
|00001b90| 62 69 74 73 20 74 68 61 | 74 20 61 72 65 20 72 65 |bits tha|t are re|
|00001ba0| 73 65 72 76 65 64 20 28 | 75 6e 75 73 65 64 20 6d |served (|unused m|
|00001bb0| 65 61 6e 73 20 72 65 73 | 65 72 76 65 64 29 2e 0d |eans res|erved)..|
|00001bc0| 54 68 69 73 20 68 61 73 | 20 62 65 65 6e 20 64 65 |This has| been de|
|00001bd0| 74 65 72 6d 69 6e 65 64 | 20 66 72 6f 6d 20 65 78 |termined| from ex|
|00001be0| 74 65 6e 73 69 76 65 20 | 74 65 73 74 69 6e 67 20 |tensive |testing |
|00001bf0| 6f 66 20 6f 75 72 20 64 | 69 76 65 72 73 65 20 73 |of our d|iverse s|
|00001c00| 6f 66 74 77 61 72 65 20 | 62 61 73 65 2e 0d 41 73 |oftware |base..As|
|00001c10| 73 75 6d 69 6e 67 20 74 | 68 65 20 73 63 72 65 65 |suming t|he scree|
|00001c20| 6e 20 69 73 20 61 20 66 | 69 78 65 64 20 73 69 7a |n is a f|ixed siz|
|00001c30| 65 0d 44 6f 20 6e 6f 74 | 20 61 73 73 75 6d 65 20 |e.Do not| assume |
|00001c40| 74 68 61 74 20 74 68 65 | 20 4d 61 63 69 6e 74 6f |that the| Macinto|
|00001c50| 73 68 20 73 63 72 65 65 | 6e 20 69 73 20 35 31 32 |sh scree|n is 512|
|00001c60| 20 78 20 33 34 32 20 70 | 69 78 65 6c 73 2e 20 50 | x 342 p|ixels. P|
|00001c70| 72 6f 67 72 61 6d 73 20 | 74 68 61 74 20 64 6f 20 |rograms |that do |
|00001c80| 67 65 6e 65 72 61 6c 6c | 79 20 68 61 76 65 20 70 |generall|y have p|
|00001c90| 72 6f 62 6c 65 6d 73 20 | 6f 6e 20 28 6f 72 20 73 |roblems |on (or s|
|00001ca0| 70 65 63 69 61 6c 20 63 | 61 73 65 20 66 6f 72 29 |pecial c|ase for)|
|00001cb0| 20 74 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 58 | the Mac|intosh X|
|00001cc0| 4c 2c 20 77 68 69 63 68 | 20 68 61 73 20 61 20 77 |L, which| has a w|
|00001cd0| 69 64 65 72 20 73 63 72 | 65 65 6e 2e 20 4d 6f 73 |ider scr|een. Mos|
|00001ce0| 74 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 68 |t applic|ations h|
|00001cf0| 61 76 65 20 74 6f 20 63 | 72 65 61 74 65 20 74 68 |ave to c|reate th|
|00001d00| 65 20 62 6f 75 6e 64 69 | 6e 67 20 72 65 63 74 61 |e boundi|ng recta|
|00001d10| 6e 67 6c 65 20 77 68 65 | 72 65 20 61 20 77 69 6e |ngle whe|re a win|
|00001d20| 64 6f 77 20 63 61 6e 20 | 62 65 20 64 72 61 67 67 |dow can |be dragg|
|00001d30| 65 64 2e 20 54 68 69 73 | 20 69 73 20 74 68 65 20 |ed. This| is the |
|00001d40| 62 6f 75 6e 64 73 52 65 | 63 74 20 74 68 61 74 20 |boundsRe|ct that |
|00001d50| 69 73 20 70 61 73 73 65 | 64 20 74 6f 20 74 68 65 |is passe|d to the|
|00001d60| 20 63 61 6c 6c 3a 0d 09 | 44 72 61 67 57 69 6e 64 | call:..|DragWind|
|00001d70| 6f 77 20 28 6d 79 57 69 | 6e 64 6f 77 50 74 72 2c |ow (myWi|ndowPtr,|
|00001d80| 20 74 68 65 45 76 65 6e | 74 2e 77 68 65 72 65 2c | theEven|t.where,|
|00001d90| 20 62 6f 75 6e 64 73 52 | 65 63 74 29 3b 0d 53 6f | boundsR|ect);.So|
|00001da0| 6d 65 20 69 6c 6c 2d 61 | 64 76 69 73 65 64 20 70 |me ill-a|dvised p|
|00001db0| 72 6f 67 72 61 6d 73 20 | 63 72 65 61 74 65 20 74 |rograms |create t|
|00001dc0| 68 65 20 62 6f 75 6e 64 | 73 52 65 63 74 20 62 79 |he bound|sRect by|
|00001dd0| 20 73 6f 6d 65 74 68 69 | 6e 67 20 6c 69 6b 65 3a | somethi|ng like:|
|00001de0| 0d 09 53 65 74 52 65 63 | 74 20 28 62 6f 75 6e 64 |..SetRec|t (bound|
|00001df0| 73 52 65 63 74 2c 20 30 | 2c 30 2c 33 34 32 2c 35 |sRect, 0|,0,342,5|
|00001e00| 31 32 29 3b 20 20 7b 20 | 6f 6f 70 73 2c 20 74 68 |12); { |oops, th|
|00001e10| 69 73 20 69 73 20 68 61 | 72 64 2d 63 6f 64 65 64 |is is ha|rd-coded|
|00001e20| c9 7d 0d 57 68 79 20 69 | 74 d5 73 20 42 61 64 0d |.}.Why i|t.s Bad.|
|00001e30| 54 68 69 73 20 69 73 20 | 62 61 64 20 62 65 63 61 |This is |bad beca|
|00001e40| 75 73 65 20 69 74 20 69 | 73 20 6e 65 76 65 72 20 |use it i|s never |
|00001e50| 6e 65 63 65 73 73 61 72 | 79 20 74 6f 20 73 70 65 |necessar|y to spe|
|00001e60| 63 69 66 69 63 61 6c 6c | 79 20 70 75 74 20 69 6e |cificall|y put in|
|00001e70| 20 74 68 65 20 62 6f 75 | 6e 64 69 6e 67 20 72 65 | the bou|nding re|
|00001e80| 63 74 61 6e 67 6c 65 20 | 66 6f 72 20 74 68 65 20 |ctangle |for the |
|00001e90| 73 63 72 65 65 6e 2e 20 | 4f 6e 20 61 20 4d 61 63 |screen. |On a Mac|
|00001ea0| 69 6e 74 6f 73 68 20 58 | 4c 20 66 6f 72 20 65 78 |intosh X|L for ex|
|00001eb0| 61 6d 70 6c 65 2c 20 74 | 68 65 20 73 63 72 65 65 |ample, t|he scree|
|00001ec0| 6e 20 73 69 7a 65 20 69 | 73 20 37 36 30 78 33 36 |n size i|s 760x36|
|00001ed0| 34 20 28 61 6e 64 20 73 | 6f 6d 65 74 69 6d 65 73 |4 (and s|ometimes|
|00001ee0| 20 36 30 38 78 34 33 31 | 20 77 69 74 68 20 61 6c | 608x431| with al|
|00001ef0| 74 65 72 6e 61 74 65 20 | 68 61 72 64 77 61 72 65 |ternate |hardware|
|00001f00| 29 2e 20 49 66 20 61 20 | 70 72 6f 67 72 61 6d 20 |). If a |program |
|00001f10| 75 73 65 73 20 74 68 65 | 20 68 61 72 64 2d 63 6f |uses the| hard-co|
|00001f20| 64 65 64 20 30 2c 30 2c | 33 34 32 2c 35 31 32 20 |ded 0,0,|342,512 |
|00001f30| 61 73 20 61 20 62 6f 75 | 6e 64 69 6e 67 20 72 65 |as a bou|nding re|
|00001f40| 63 74 61 6e 67 6c 65 2c | 20 65 6e 64 20 75 73 65 |ctangle,| end use|
|00001f50| 72 73 20 77 69 6c 6c 20 | 6e 6f 74 20 62 65 20 61 |rs will |not be a|
|00001f60| 62 6c 65 20 74 6f 20 6d | 6f 76 65 20 74 68 65 69 |ble to m|ove thei|
|00001f70| 72 20 77 69 6e 64 6f 77 | 73 20 70 61 73 74 20 74 |r window|s past t|
|00001f80| 68 65 20 66 69 63 74 69 | 74 69 6f 75 73 20 62 6f |he ficti|tious bo|
|00001f90| 75 6e 64 61 72 79 20 6f | 66 20 35 31 32 2e 20 49 |undary o|f 512. I|
|00001fa0| 66 20 73 6f 6d 65 74 68 | 69 6e 67 20 73 69 6d 69 |f someth|ing simi|
|00001fb0| 6c 61 72 20 77 65 72 65 | 20 64 6f 6e 65 20 74 6f |lar were| done to|
|00001fc0| 20 74 68 65 20 47 72 6f | 77 57 69 6e 64 6f 77 20 | the Gro|wWindow |
|00001fd0| 63 61 6c 6c 2c 20 69 74 | 20 77 6f 75 6c 64 20 6d |call, it| would m|
|00001fe0| 61 6b 65 20 69 74 20 69 | 6d 70 6f 73 73 69 62 6c |ake it i|mpossibl|
|00001ff0| 65 20 66 6f 72 20 75 73 | 65 72 73 20 74 6f 20 67 |e for us|ers to g|
|00002000| 72 6f 77 20 74 68 65 69 | 72 20 77 69 6e 64 6f 77 |row thei|r window|
|00002010| 20 74 6f 20 66 69 6c 6c | 20 74 68 65 20 65 6e 74 | to fill| the ent|
|00002020| 69 72 65 20 73 63 72 65 | 65 6e 2e 20 28 41 6c 77 |ire scre|en. (Alw|
|00002030| 61 79 73 20 61 20 73 61 | 64 64 65 6e 69 6e 67 20 |ays a sa|ddening |
|00002040| 77 61 73 74 65 20 6f 66 | 20 76 61 6c 75 61 62 6c |waste of| valuabl|
|00002050| 65 20 73 63 72 65 65 6e | 20 72 65 61 6c 2d 65 73 |e screen| real-es|
|00002060| 74 61 74 65 2e 29 0d 41 | 73 73 75 6d 69 6e 67 20 |tate.).A|ssuming |
|00002070| 73 63 72 65 65 6e 20 73 | 69 7a 65 20 6d 61 6b 65 |screen s|ize make|
|00002080| 73 20 69 74 20 6d 6f 72 | 65 20 64 69 66 66 69 63 |s it mor|e diffic|
|00002090| 75 6c 74 20 74 6f 20 75 | 73 65 20 74 68 65 20 70 |ult to u|se the p|
|000020a0| 72 6f 67 72 61 6d 20 6f | 6e 20 4d 61 63 69 6e 74 |rogram o|n Macint|
|000020b0| 6f 73 68 65 73 20 77 69 | 74 68 20 62 69 67 20 73 |oshes wi|th big s|
|000020c0| 63 72 65 65 6e 73 2c 20 | 62 79 20 6d 61 6b 69 6e |creens, |by makin|
|000020d0| 67 20 69 74 20 64 69 66 | 66 69 63 75 6c 74 20 74 |g it dif|ficult t|
|000020e0| 6f 20 67 72 6f 77 20 6f | 72 20 6d 6f 76 65 20 77 |o grow o|r move w|
|000020f0| 69 6e 64 6f 77 73 2c 20 | 6f 72 20 62 79 20 64 72 |indows, |or by dr|
|00002100| 61 77 69 6e 67 20 69 6e | 20 73 74 72 61 6e 67 65 |awing in| strange|
|00002110| 20 70 6c 61 63 65 73 20 | 77 68 65 72 65 20 74 68 | places |where th|
|00002120| 65 79 20 73 68 6f 75 6c | 64 20 6e 6f 74 20 62 65 |ey shoul|d not be|
|00002130| 20 64 72 61 77 69 6e 67 | 20 28 6f 75 74 73 69 64 | drawing| (outsid|
|00002140| 65 20 6f 66 20 77 69 6e | 64 6f 77 73 29 2e 20 43 |e of win|dows). C|
|00002150| 6f 6e 73 69 64 65 72 20 | 74 68 65 20 63 61 73 65 |onsider |the case|
|00002160| 20 6f 66 20 72 75 6e 6e | 69 6e 67 20 6f 6e 20 61 | of runn|ing on a|
|00002170| 20 4d 61 63 69 6e 74 6f | 73 68 20 65 71 75 69 70 | Macinto|sh equip|
|00002180| 70 65 64 20 77 69 74 68 | 20 6f 6e 65 20 6f 66 20 |ped with| one of |
|00002190| 74 68 65 20 66 75 6c 6c | 20 70 61 67 65 20 64 69 |the full| page di|
|000021a0| 73 70 6c 61 79 73 2c 20 | 6f 72 20 55 6c 74 72 61 |splays, |or Ultra|
|000021b0| 2d 4c 61 72 67 65 20 73 | 63 72 65 65 6e 73 2e 20 |-Large s|creens. |
|000021c0| 4e 6f 20 6f 6e 65 20 77 | 68 6f 20 70 61 69 64 20 |No one w|ho paid |
|000021d0| 66 6f 72 20 61 20 62 69 | 67 20 73 63 72 65 65 6e |for a bi|g screen|
|000021e0| 20 77 61 6e 74 73 20 74 | 6f 20 62 65 20 72 65 73 | wants t|o be res|
|000021f0| 74 72 69 63 74 65 64 20 | 74 6f 20 75 73 69 6e 67 |tricted |to using|
|00002200| 20 6f 6e 6c 79 20 74 68 | 65 20 75 70 70 65 72 2d | only th|e upper-|
|00002210| 6c 65 66 74 20 63 6f 72 | 6e 65 72 20 6f 66 20 69 |left cor|ner of i|
|00002220| 74 2e 0d 48 6f 77 20 74 | 6f 20 61 76 6f 69 64 20 |t..How t|o avoid |
|00002230| 62 65 63 6f 6d 69 6e 67 | 20 61 20 73 63 72 65 65 |becoming| a scree|
|00002240| 6e 69 6e 67 20 66 61 73 | 63 69 73 74 0d 4e 65 76 |ning fas|cist.Nev|
|00002250| 65 72 20 68 61 72 64 20 | 63 6f 64 65 20 74 68 65 |er hard |code the|
|00002260| 20 6e 75 6d 62 65 72 73 | 20 35 31 32 20 61 6e 64 | numbers| 512 and|
|00002270| 20 33 34 32 20 66 6f 72 | 20 73 63 72 65 65 6e 20 | 342 for| screen |
|00002280| 64 69 6d 65 6e 73 69 6f | 6e 73 2e 20 59 6f 75 20 |dimensio|ns. You |
|00002290| 73 68 6f 75 6c 64 20 61 | 76 6f 69 64 20 75 73 69 |should a|void usi|
|000022a0| 6e 67 20 63 6f 6e 73 74 | 61 6e 74 73 20 66 6f 72 |ng const|ants for|
|000022b0| 20 73 79 73 74 65 6d 20 | 76 61 6c 75 65 73 20 74 | system |values t|
|000022c0| 68 61 74 20 63 61 6e 20 | 63 68 61 6e 67 65 2e 20 |hat can |change. |
|000022d0| 50 61 72 61 6d 65 74 65 | 72 73 20 6c 69 6b 65 20 |Paramete|rs like |
|000022e0| 74 68 65 73 65 20 61 72 | 65 20 6e 65 61 72 6c 79 |these ar|e nearly|
|000022f0| 20 61 6c 77 61 79 73 20 | 61 76 61 69 6c 61 62 6c | always |availabl|
|00002300| 65 20 69 6e 20 61 20 64 | 79 6e 61 6d 69 63 20 66 |e in a d|ynamic f|
|00002310| 61 73 68 69 6f 6e 2e 20 | 50 72 6f 67 72 61 6d 73 |ashion. |Programs|
|00002320| 20 73 68 6f 75 6c 64 20 | 72 65 61 64 20 74 68 65 | should |read the|
|00002330| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 76 61 72 | appropr|iate var|
|00002340| 69 61 62 6c 65 73 20 77 | 68 69 6c 65 20 74 68 65 |iables w|hile the|
|00002350| 20 70 72 6f 67 72 61 6d | 20 69 73 20 72 75 6e 6e | program| is runn|
|00002360| 69 6e 67 20 28 61 74 20 | 72 75 6e 2d 74 69 6d 65 |ing (at |run-time|
|00002370| 2c 20 6e 6f 74 20 61 74 | 20 63 6f 6d 70 69 6c 65 |, not at| compile|
|00002380| 20 74 69 6d 65 29 2e 0d | 48 65 72 65 d5 73 20 68 | time)..|Here.s h|
|00002390| 6f 77 20 73 6d 61 72 74 | 20 70 72 6f 67 72 61 6d |ow smart| program|
|000023a0| 73 20 67 65 74 20 74 68 | 65 20 73 63 72 65 65 6e |s get th|e screen|
|000023b0| 20 64 69 6d 65 6e 73 69 | 6f 6e 73 3a 0d 09 49 6e | dimensi|ons:..In|
|000023c0| 69 74 47 72 61 66 28 40 | 74 68 65 50 6f 72 74 29 |itGraf(@|thePort)|
|000023d0| 3b 20 7b 20 51 75 69 63 | 6b 44 72 61 77 20 67 6c |; { Quic|kDraw gl|
|000023e0| 6f 62 61 6c 20 76 61 72 | 69 61 62 6c 65 73 20 68 |obal var|iables h|
|000023f0| 61 76 65 20 74 6f 20 62 | 65 20 69 6e 69 74 69 61 |ave to b|e initia|
|00002400| 6c 69 7a 65 64 2e 7d 0d | 09 c9 0d 09 62 6f 75 6e |lized.}.|....boun|
|00002410| 64 73 52 65 63 74 20 3a | 3d 20 73 63 72 65 65 6e |dsRect :|= screen|
|00002420| 42 69 74 73 2e 62 6f 75 | 6e 64 73 3b 20 20 20 7b |Bits.bou|nds; {|
|00002430| 20 54 68 65 20 52 65 61 | 6c 20 77 61 79 20 74 6f | The Rea|l way to|
|00002440| 20 67 65 74 20 73 63 72 | 65 65 6e 20 73 69 7a 65 | get scr|een size|
|00002450| 20 7d 0d 09 09 20 20 20 | 20 20 20 20 20 20 20 20 | }... | |
|00002460| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002470| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 09 09 20 | | .. |
|00002480| 20 7b 20 55 73 65 20 51 | 75 69 63 6b 44 72 61 77 | { Use Q|uickDraw|
|00002490| 20 67 6c 6f 62 61 6c 20 | 76 61 72 69 61 62 6c 65 | global |variable|
|000024a0| 2e 20 7d 0d 54 68 69 73 | 20 69 73 20 73 6d 61 72 |. }.This| is smar|
|000024b0| 74 2c 20 62 65 63 61 75 | 73 65 20 74 68 65 20 70 |t, becau|se the p|
|000024c0| 72 6f 67 72 61 6d 20 6e | 65 76 65 72 20 68 61 73 |rogram n|ever has|
|000024d0| 20 74 6f 20 6b 6e 6f 77 | 20 73 70 65 63 69 66 69 | to know| specifi|
|000024e0| 63 61 6c 6c 79 20 77 68 | 61 74 20 74 68 65 20 6e |cally wh|at the n|
|000024f0| 75 6d 62 65 72 73 20 61 | 72 65 2e 20 41 6c 6c 20 |umbers a|re. All |
|00002500| 72 65 66 65 72 65 6e 63 | 65 73 20 74 6f 20 72 65 |referenc|es to re|
|00002510| 63 74 61 6e 67 6c 65 73 | 20 74 68 61 74 20 6e 65 |ctangles| that ne|
|00002520| 65 64 20 74 6f 20 62 65 | 20 72 65 6c 61 74 65 64 |ed to be| related|
|00002530| 20 74 6f 20 74 68 65 20 | 73 63 72 65 65 6e 20 28 | to the |screen (|
|00002540| 6c 69 6b 65 20 74 68 65 | 20 64 72 61 67 20 61 6e |like the| drag an|
|00002550| 64 20 67 72 6f 77 20 61 | 72 65 61 73 20 6f 66 20 |d grow a|reas of |
|00002560| 77 69 6e 64 6f 77 73 29 | 20 73 68 6f 75 6c 64 20 |windows)| should |
|00002570| 75 73 65 20 73 63 72 65 | 65 6e 42 69 74 73 2e 62 |use scre|enBits.b|
|00002580| 6f 75 6e 64 73 20 74 6f | 20 61 76 6f 69 64 20 77 |ounds to| avoid w|
|00002590| 6f 72 72 79 69 6e 67 20 | 61 62 6f 75 74 20 74 68 |orrying |about th|
|000025a0| 65 20 73 63 72 65 65 6e | 20 73 69 7a 65 2e 0d 4e |e screen| size..N|
|000025b0| 6f 74 65 20 74 68 61 74 | 20 74 68 69 73 20 64 6f |ote that| this do|
|000025c0| 65 73 20 6e 6f 74 20 64 | 6f 20 61 6e 79 74 68 69 |es not d|o anythi|
|000025d0| 6e 67 20 72 65 6d 6f 74 | 65 6c 79 20 6c 69 6b 65 |ng remot|ely like|
|000025e0| 20 61 73 73 75 6d 65 20 | 74 68 61 74 20 d2 69 66 | assume |that .if|
|000025f0| 20 74 68 65 20 63 6f 6d | 70 75 74 65 72 20 69 73 | the com|puter is|
|00002600| 20 6e 6f 74 20 61 20 73 | 74 61 6e 64 61 72 64 20 | not a s|tandard |
|00002610| 4d 61 63 69 6e 74 6f 73 | 68 2c 20 74 68 65 6e 20 |Macintos|h, then |
|00002620| 69 74 20 6d 75 73 74 20 | 62 65 20 61 6e 20 58 4c |it must |be an XL|
|00002630| 2e d3 20 53 70 65 63 69 | 61 6c 20 63 61 73 69 6e |.. Speci|al casin|
|00002640| 67 20 66 6f 72 20 74 68 | 65 20 76 61 72 69 6f 75 |g for th|e variou|
|00002650| 73 20 76 65 72 73 69 6f | 6e 73 20 6f 66 20 74 68 |s versio|ns of th|
|00002660| 65 20 4d 61 63 69 6e 74 | 6f 73 68 20 68 61 73 20 |e Macint|osh has |
|00002670| 61 6c 77 61 79 73 20 62 | 65 65 6e 20 73 75 73 70 |always b|een susp|
|00002680| 69 63 69 6f 75 73 20 61 | 74 20 62 65 73 74 3b 20 |icious a|t best; |
|00002690| 69 74 20 69 73 20 6e 6f | 77 20 67 72 6f 75 6e 64 |it is no|w ground|
|000026a0| 73 20 66 6f 72 20 62 72 | 65 61 6b 69 6e 67 2e 20 |s for br|eaking. |
|000026b0| 28 41 74 20 6c 65 61 73 | 74 20 77 69 74 68 20 72 |(At leas|t with r|
|000026c0| 65 73 70 65 63 74 20 74 | 6f 20 73 63 72 65 65 6e |espect t|o screen|
|000026d0| 20 64 69 6d 65 6e 73 69 | 6f 6e 73 2e 29 0d 42 79 | dimensi|ons.).By|
|000026e0| 20 74 68 65 20 77 61 79 | 2c 20 72 65 6d 65 6d 62 | the way|, rememb|
|000026f0| 65 72 20 74 6f 20 74 61 | 6b 65 20 69 6e 74 6f 20 |er to ta|ke into |
|00002700| 61 63 63 6f 75 6e 74 20 | 74 68 65 20 6d 65 6e 75 |account |the menu|
|00002710| 20 62 61 72 20 68 65 69 | 67 68 74 20 77 68 65 6e | bar hei|ght when|
|00002720| 20 75 73 69 6e 67 20 74 | 68 69 73 20 72 65 63 74 | using t|his rect|
|00002730| 61 6e 67 6c 65 2e 20 4f | 6e 20 31 32 38 4b 20 52 |angle. O|n 128K R|
|00002740| 4f 4d 73 20 28 61 6e 64 | 20 6c 61 74 65 72 29 20 |OMs (and| later) |
|00002750| 79 6f 75 20 63 61 6e 20 | 75 73 65 20 74 68 65 20 |you can |use the |
|00002760| 6c 6f 77 2d 6d 65 6d 6f | 72 79 20 67 6c 6f 62 61 |low-memo|ry globa|
|00002770| 6c 20 6d 42 61 72 48 65 | 69 67 68 74 20 28 61 20 |l mBarHe|ight (a |
|00002780| 77 6f 72 64 20 61 74 20 | 24 42 41 41 29 2e 20 42 |word at |$BAA). B|
|00002790| 75 74 20 73 69 6e 63 65 | 20 77 65 20 64 69 64 6e |ut since| we didn|
|000027a0| d5 74 20 70 72 6f 76 69 | 64 65 20 61 20 6c 6f 77 |.t provi|de a low|
|000027b0| 2d 6d 65 6d 6f 72 79 20 | 67 6c 6f 62 61 6c 20 66 |-memory |global f|
|000027c0| 6f 72 20 74 68 65 20 6d | 65 6e 75 20 62 61 72 20 |or the m|enu bar |
|000027d0| 68 65 69 67 68 74 20 69 | 6e 20 74 68 65 20 36 34 |height i|n the 64|
|000027e0| 4b 20 52 4f 4d 73 2c 20 | 79 6f 75 d5 6c 6c 20 68 |K ROMs, |you.ll h|
|000027f0| 61 76 65 20 74 6f 20 68 | 61 72 64 20 63 6f 64 65 |ave to h|ard code|
|00002800| 20 69 74 20 74 6f 20 32 | 30 20 28 24 31 34 29 2e | it to 2|0 ($14).|
|00002810| 20 28 59 6f 75 d5 72 65 | 20 6e 6f 74 20 74 68 65 | (You.re| not the|
|00002820| 20 6f 6e 6c 79 20 6f 6e | 65 73 20 74 6f 20 66 6f | only on|es to fo|
|00002830| 72 67 65 74 20 74 68 65 | 20 66 75 74 75 72 65 20 |rget the| future |
|00002840| 68 6f 6c 64 73 20 63 68 | 61 6e 67 65 73 2e 29 0d |holds ch|anges.).|
|00002850| 48 6f 77 20 74 6f 20 66 | 69 6e 64 20 66 61 73 63 |How to f|ind fasc|
|00002860| 69 73 74 20 73 63 72 65 | 65 6e 69 73 6d 20 69 6e |ist scre|enism in|
|00002870| 20 63 75 72 72 65 6e 74 | 20 70 72 6f 67 72 61 6d | current| program|
|00002880| 73 0d 54 68 65 20 65 61 | 73 69 65 73 74 20 77 61 |s.The ea|siest wa|
|00002890| 79 20 69 73 20 74 6f 20 | 65 78 65 72 63 69 73 65 |y is to |exercise|
|000028a0| 20 79 6f 75 72 20 70 72 | 6f 67 72 61 6d 20 6f 6e | your pr|ogram on|
|000028b0| 20 6f 6e 65 20 6f 66 20 | 74 68 65 20 55 6c 74 72 | one of |the Ultr|
|000028c0| 61 2d 4c 61 72 67 65 20 | 73 63 72 65 65 6e 20 4d |a-Large |screen M|
|000028d0| 61 63 69 6e 74 6f 73 68 | 65 73 2e 20 54 68 65 72 |acintosh|es. Ther|
|000028e0| 65 20 73 68 6f 75 6c 64 | 20 62 65 20 6e 6f 20 72 |e should| be no r|
|000028f0| 65 73 74 72 69 63 74 69 | 6f 6e 73 20 6f 6e 20 73 |estricti|ons on s|
|00002900| 69 7a 69 6e 67 20 6f 72 | 20 6d 6f 76 69 6e 67 20 |izing or| moving |
|00002910| 74 68 65 20 77 69 6e 64 | 6f 77 73 2c 20 61 6e 64 |the wind|ows, and|
|00002920| 20 61 6c 6c 20 64 72 61 | 77 69 6e 67 20 73 68 6f | all dra|wing sho|
|00002930| 75 6c 64 20 68 61 76 65 | 20 6e 6f 20 70 72 6f 62 |uld have| no prob|
|00002940| 6c 65 6d 73 2e 20 49 66 | 20 74 68 65 72 65 20 61 |lems. If| there a|
|00002950| 72 65 20 61 6e 79 20 61 | 6e 6f 6d 61 6c 69 65 73 |re any a|nomalies|
|00002960| 20 69 6e 20 74 68 65 20 | 70 72 6f 67 72 61 6d d5 | in the |program.|
|00002970| 73 20 75 73 61 67 65 2c | 20 74 68 65 72 65 20 69 |s usage,| there i|
|00002980| 73 20 70 72 6f 62 61 62 | 6c 79 20 61 20 6c 75 72 |s probab|ly a lur|
|00002990| 6b 69 6e 67 20 70 72 6f | 62 6c 65 6d 2e 20 41 6c |king pro|blem. Al|
|000029a0| 73 6f 2c 20 64 6f 20 61 | 20 67 6c 6f 62 61 6c 20 |so, do a| global |
|000029b0| 66 69 6e 64 20 69 6e 20 | 74 68 65 20 73 6f 75 72 |find in |the sour|
|000029c0| 63 65 20 63 6f 64 65 20 | 74 6f 20 73 65 65 20 69 |ce code |to see i|
|000029d0| 66 20 74 68 65 20 6e 75 | 6d 62 65 72 73 20 35 31 |f the nu|mbers 51|
|000029e0| 32 20 6f 72 20 33 34 32 | 20 6f 63 63 75 72 20 69 |2 or 342| occur i|
|000029f0| 6e 20 74 68 65 20 70 72 | 6f 67 72 61 6d 2e 20 49 |n the pr|ogram. I|
|00002a00| 66 20 73 6f 2c 20 61 6e | 64 20 69 66 20 74 68 65 |f so, an|d if the|
|00002a10| 79 20 61 72 65 20 69 6e | 20 72 65 66 65 72 65 6e |y are in| referen|
|00002a20| 63 65 20 74 6f 20 74 68 | 65 20 73 63 72 65 65 6e |ce to th|e screen|
|00002a30| 2c 20 65 78 63 69 73 65 | 20 74 68 65 6d 2e 0d 41 |, excise| them..A|
|00002a40| 73 73 75 6d 69 6e 67 20 | 74 68 65 20 73 63 72 65 |ssuming |the scre|
|00002a50| 65 6e 20 69 73 20 61 74 | 20 61 20 66 69 78 65 64 |en is at| a fixed|
|00002a60| 20 6c 6f 63 61 74 69 6f | 6e 0d 53 6f 6d 65 20 70 | locatio|n.Some p|
|00002a70| 72 6f 67 72 61 6d 73 20 | 75 73 65 20 61 20 66 69 |rograms |use a fi|
|00002a80| 78 65 64 20 73 63 72 65 | 65 6e 20 61 64 64 72 65 |xed scre|en addre|
|00002a90| 73 73 2c 20 61 73 73 75 | 6d 69 6e 67 20 74 68 61 |ss, assu|ming tha|
|00002aa0| 74 20 74 68 65 20 73 63 | 72 65 65 6e 20 6c 6f 63 |t the sc|reen loc|
|00002ab0| 61 74 69 6f 6e 20 77 69 | 6c 6c 20 62 65 20 74 68 |ation wi|ll be th|
|00002ac0| 65 20 73 61 6d 65 20 6f | 6e 20 76 61 72 69 6f 75 |e same o|n variou|
|00002ad0| 73 20 69 6e 63 61 72 6e | 61 74 69 6f 6e 73 20 6f |s incarn|ations o|
|00002ae0| 66 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 2e |f the Ma|cintosh.|
|00002af0| 20 54 68 69 73 20 69 73 | 20 6e 6f 74 20 74 68 65 | This is| not the|
|00002b00| 20 63 61 73 65 2e 20 46 | 6f 72 20 65 78 61 6d 70 | case. F|or examp|
|00002b10| 6c 65 2c 20 74 68 65 20 | 73 63 72 65 65 6e 20 69 |le, the |screen i|
|00002b20| 73 20 6c 6f 63 61 74 65 | 64 20 61 74 20 6d 65 6d |s locate|d at mem|
|00002b30| 6f 72 79 20 6c 6f 63 61 | 74 69 6f 6e 20 24 31 41 |ory loca|tion $1A|
|00002b40| 37 30 30 20 6f 6e 20 61 | 20 31 32 38 4b 20 4d 61 |700 on a| 128K Ma|
|00002b50| 63 69 6e 74 6f 73 68 2c | 20 61 74 20 24 37 41 37 |cintosh,| at $7A7|
|00002b60| 30 30 20 6f 6e 20 61 20 | 35 31 32 4b 20 4d 61 63 |00 on a |512K Mac|
|00002b70| 69 6e 74 6f 73 68 2c 20 | 61 74 20 24 46 38 30 30 |intosh, |at $F800|
|00002b80| 30 20 6f 6e 20 74 68 65 | 20 4d 61 63 69 6e 74 6f |0 on the| Macinto|
|00002b90| 73 68 20 58 4c 2c 20 61 | 6e 64 20 61 74 20 24 46 |sh XL, a|nd at $F|
|00002ba0| 41 37 30 30 20 6f 6e 20 | 74 68 65 20 4d 61 63 69 |A700 on |the Maci|
|00002bb0| 6e 74 6f 73 68 20 50 6c | 75 73 2e 0d 57 68 79 20 |ntosh Pl|us..Why |
|00002bc0| 69 74 d5 73 20 42 61 64 | 0d 57 68 65 6e 20 61 20 |it.s Bad|.When a |
|00002bd0| 70 72 6f 67 72 61 6d 20 | 72 65 6c 69 65 73 20 75 |program |relies u|
|00002be0| 70 6f 6e 20 74 68 65 20 | 73 63 72 65 65 6e 20 62 |pon the |screen b|
|00002bf0| 65 69 6e 67 20 69 6e 20 | 61 20 66 69 78 65 64 20 |eing in |a fixed |
|00002c00| 6c 6f 63 61 74 69 6f 6e | 2c 20 4d 75 72 70 68 79 |location|, Murphy|
|00002c10| d5 73 20 4c 61 77 20 64 | 69 63 74 61 74 65 73 20 |.s Law d|ictates |
|00002c20| 74 68 61 74 20 61 6e 20 | 75 6e 6b 6e 6f 77 69 6e |that an |unknowin|
|00002c30| 67 20 75 73 65 72 20 77 | 69 6c 6c 20 72 75 6e 20 |g user w|ill run |
|00002c40| 69 74 20 75 70 6f 6e 20 | 61 20 63 6f 6d 70 75 74 |it upon |a comput|
|00002c50| 65 72 20 77 69 74 68 20 | 74 68 65 20 73 63 72 65 |er with |the scre|
|00002c60| 65 6e 20 69 6e 20 61 20 | 64 69 66 66 65 72 65 6e |en in a |differen|
|00002c70| 74 20 6c 6f 63 61 74 69 | 6f 6e 2e 20 54 68 69 73 |t locati|on. This|
|00002c80| 20 75 73 75 61 6c 6c 79 | 20 63 61 75 73 65 73 20 | usually| causes |
|00002c90| 74 68 65 20 73 79 73 74 | 65 6d 20 74 6f 20 63 72 |the syst|em to cr|
|00002ca0| 61 73 68 2c 20 73 69 6e | 63 65 20 74 68 65 20 6f |ash, sin|ce the o|
|00002cb0| 66 66 65 6e 64 69 6e 67 | 20 70 72 6f 67 72 61 6d |ffending| program|
|00002cc0| 20 77 69 6c 6c 20 77 72 | 69 74 65 20 74 6f 20 6d | will wr|ite to m|
|00002cd0| 65 6d 6f 72 79 20 74 68 | 61 74 20 77 61 73 20 75 |emory th|at was u|
|00002ce0| 73 65 64 20 66 6f 72 20 | 73 6f 6d 65 74 68 69 6e |sed for |somethin|
|00002cf0| 67 20 69 6d 70 6f 72 74 | 61 6e 74 2e 20 50 72 6f |g import|ant. Pro|
|00002d00| 67 72 61 6d 73 20 74 68 | 61 74 20 63 72 61 73 68 |grams th|at crash|
|00002d10| 20 68 61 76 65 20 62 65 | 65 6e 20 70 72 6f 76 65 | have be|en prove|
|00002d20| 6e 20 74 6f 20 62 65 20 | 6c 65 73 73 20 75 73 65 |n to be |less use|
|00002d30| 66 75 6c 20 74 68 61 6e | 20 74 68 6f 73 65 20 74 |ful than| those t|
|00002d40| 68 61 74 20 64 6f 6e d5 | 74 2e 0d 48 6f 77 20 74 |hat don.|t..How t|
|00002d50| 6f 20 61 76 6f 69 64 20 | 62 65 69 6e 67 20 61 20 |o avoid |being a |
|00002d60| 62 61 73 65 20 73 63 72 | 65 65 6e 65 72 0d 53 75 |base scr|eener.Su|
|00002d70| 66 66 69 63 65 20 69 74 | 20 74 6f 20 73 61 79 20 |ffice it| to say |
|00002d80| 74 68 61 74 20 74 68 65 | 72 65 20 69 73 20 6e 6f |that the|re is no|
|00002d90| 20 77 61 79 20 74 68 61 | 74 20 74 68 65 20 61 64 | way tha|t the ad|
|00002da0| 64 72 65 73 73 20 6f 66 | 20 74 68 65 20 73 63 72 |dress of| the scr|
|00002db0| 65 65 6e 20 77 69 6c 6c | 20 72 65 6d 61 69 6e 20 |een will| remain |
|00002dc0| 73 74 61 74 69 63 2c 20 | 62 75 74 20 74 68 65 72 |static, |but ther|
|00002dd0| 65 20 61 72 65 20 72 61 | 72 65 20 6f 63 63 61 73 |e are ra|re occas|
|00002de0| 69 6f 6e 73 20 77 68 65 | 72 65 20 69 74 20 69 73 |ions whe|re it is|
|00002df0| 20 6e 65 63 65 73 73 61 | 72 79 20 74 6f 20 67 6f | necessa|ry to go|
|00002e00| 20 64 69 72 65 63 74 6c | 79 20 74 6f 20 74 68 65 | directl|y to the|
|00002e10| 20 73 63 72 65 65 6e 20 | 6d 65 6d 6f 72 79 2e 20 | screen |memory. |
|00002e20| 4f 6e 20 74 68 65 73 65 | 20 6f 63 63 61 73 69 6f |On these| occasio|
|00002e30| 6e 73 2c 20 74 68 65 72 | 65 20 61 72 65 20 62 61 |ns, ther|e are ba|
|00002e40| 64 20 77 61 79 73 20 61 | 6e 64 20 6e 6f 74 2d 61 |d ways a|nd not-a|
|00002e50| 73 2d 62 61 64 20 77 61 | 79 73 20 74 6f 20 64 6f |s-bad wa|ys to do|
|00002e60| 20 69 74 2e 20 41 20 62 | 61 64 20 77 61 79 3a 0d | it. A b|ad way:.|
|00002e70| 09 6d 79 53 63 72 65 65 | 6e 42 61 73 65 20 3a 3d |.myScree|nBase :=|
|00002e80| 20 50 6f 69 6e 74 65 72 | 20 28 24 37 41 37 30 30 | Pointer| ($7A700|
|00002e90| 29 3b 20 20 7b 20 6e 6f | 74 20 67 6f 6f 64 2e 20 |); { no|t good. |
|00002ea0| 20 48 61 72 64 2d 63 6f | 64 65 64 20 6e 75 6d 62 | Hard-co|ded numb|
|00002eb0| 65 72 2e 20 7d 0d 41 20 | 6e 6f 74 2d 61 73 2d 62 |er. }.A |not-as-b|
|00002ec0| 61 64 20 77 61 79 3a 0d | 09 49 6e 69 74 47 72 61 |ad way:.|.InitGra|
|00002ed0| 66 28 40 74 68 65 50 6f | 72 74 29 3b 20 20 20 7b |f(@thePo|rt); {|
|00002ee0| 20 64 6f 20 74 68 69 73 | 20 6f 6e 6c 79 20 6f 6e | do this| only on|
|00002ef0| 63 65 20 69 6e 20 61 20 | 70 72 6f 67 72 61 6d 2e |ce in a |program.|
|00002f00| 20 7d 0d 09 c9 0d 09 6d | 79 53 63 72 65 65 6e 42 | }.....m|yScreenB|
|00002f10| 61 73 65 20 3a 3d 20 73 | 63 72 65 65 6e 42 69 74 |ase := s|creenBit|
|00002f20| 73 2e 62 61 73 65 41 64 | 64 72 3b 20 20 7b 20 47 |s.baseAd|dr; { G|
|00002f30| 6f 6f 64 2e 20 20 41 6c | 77 61 79 73 20 77 6f 72 |ood. Al|ways wor|
|00002f40| 6b 73 2e 20 7d 0d 09 09 | 20 20 20 20 20 20 20 20 |ks. }...| |
|00002f50| 20 20 20 20 20 20 20 20 | 20 20 20 20 09 20 20 20 | | . |
|00002f60| 20 20 20 7b 59 65 74 20 | 61 6e 6f 74 68 65 72 20 | {Yet |another |
|00002f70| 51 75 69 63 6b 44 72 61 | 77 20 67 6c 6f 62 61 6c |QuickDra|w global|
|00002f80| 20 76 61 72 69 61 62 6c | 65 7d 0d 55 73 69 6e 67 | variabl|e}.Using|
|00002f90| 20 74 68 65 20 6c 61 74 | 74 65 72 20 61 70 70 72 | the lat|ter appr|
|00002fa0| 6f 61 63 68 20 69 73 20 | 67 75 61 72 61 6e 74 65 |oach is |guarante|
|00002fb0| 65 64 20 74 6f 20 77 6f | 72 6b 2c 20 73 69 6e 63 |ed to wo|rk, sinc|
|00002fc0| 65 20 51 75 69 63 6b 44 | 72 61 77 20 68 61 73 20 |e QuickD|raw has |
|00002fd0| 74 6f 20 6b 6e 6f 77 20 | 77 68 65 72 65 20 74 6f |to know |where to|
|00002fe0| 20 64 72 61 77 2c 20 61 | 6e 64 20 74 68 65 20 6f | draw, a|nd the o|
|00002ff0| 70 65 72 61 74 69 6e 67 | 20 73 79 73 74 65 6d 20 |perating| system |
|00003000| 74 65 6c 6c 73 20 51 75 | 69 63 6b 44 72 61 77 20 |tells Qu|ickDraw |
|00003010| 77 68 65 72 65 20 74 68 | 65 20 73 63 72 65 65 6e |where th|e screen|
|00003020| 20 63 61 6e 20 62 65 20 | 66 6f 75 6e 64 2e 20 57 | can be |found. W|
|00003030| 68 65 6e 20 69 6e 20 64 | 6f 75 62 74 2c 20 61 73 |hen in d|oubt, as|
|00003040| 6b 20 51 75 69 63 6b 44 | 72 61 77 2e 20 54 68 69 |k QuickD|raw. Thi|
|00003050| 73 20 77 69 6c 6c 20 77 | 6f 72 6b 20 6f 6e 20 4d |s will w|ork on M|
|00003060| 61 63 69 6e 74 6f 73 68 | 20 63 6f 6d 70 75 74 65 |acintosh| compute|
|00003070| 72 73 20 66 72 6f 6d 20 | 6e 6f 77 20 75 6e 74 69 |rs from |now unti|
|00003080| 6c 20 66 6f 72 65 76 65 | 72 2c 20 73 6f 20 69 66 |l foreve|r, so if|
|00003090| 20 79 6f 75 20 75 73 65 | 20 74 68 69 73 20 61 70 | you use| this ap|
|000030a0| 70 72 6f 61 63 68 20 79 | 6f 75 20 77 6f 6e d5 74 |proach y|ou won.t|
|000030b0| 20 68 61 76 65 20 74 6f | 20 72 65 76 69 73 65 20 | have to| revise |
|000030c0| 79 6f 75 72 20 70 72 6f | 67 72 61 6d 20 6a 75 73 |your pro|gram jus|
|000030d0| 74 20 62 65 63 61 75 73 | 65 20 74 68 65 20 73 63 |t becaus|e the sc|
|000030e0| 72 65 65 6e 20 6d 6f 76 | 65 64 20 69 6e 20 6d 65 |reen mov|ed in me|
|000030f0| 6d 6f 72 79 2e 0d 49 66 | 20 79 6f 75 20 68 61 76 |mory..If| you hav|
|00003100| 65 20 61 20 70 72 6f 67 | 72 61 6d 20 28 73 75 63 |e a prog|ram (suc|
|00003110| 68 20 61 73 20 61 6e 20 | 49 4e 49 54 29 20 74 68 |h as an |INIT) th|
|00003120| 61 74 20 63 61 6e 6e 6f | 74 20 72 65 6c 79 20 75 |at canno|t rely u|
|00003130| 70 6f 6e 20 51 75 69 63 | 6b 44 72 61 77 20 62 65 |pon Quic|kDraw be|
|00003140| 69 6e 67 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 20 |ing init|ialized |
|00003150| 28 76 69 61 20 49 6e 69 | 74 47 72 61 66 29 2c 20 |(via Ini|tGraf), |
|00003160| 74 68 65 6e 20 69 74 20 | 69 73 20 70 6f 73 73 69 |then it |is possi|
|00003170| 62 6c 65 20 74 6f 20 75 | 73 65 20 74 68 65 20 53 |ble to u|se the S|
|00003180| 63 72 6e 42 61 73 65 20 | 6c 6f 77 2d 6d 65 6d 6f |crnBase |low-memo|
|00003190| 72 79 20 67 6c 6f 62 61 | 6c 20 76 61 72 69 61 62 |ry globa|l variab|
|000031a0| 6c 65 20 28 61 20 6c 6f | 6e 67 20 77 6f 72 64 20 |le (a lo|ng word |
|000031b0| 61 74 20 24 38 32 34 29 | 2e 20 54 68 69 73 20 6d |at $824)|. This m|
|000031c0| 65 74 68 6f 64 20 72 75 | 6e 73 20 61 20 64 69 73 |ethod ru|ns a dis|
|000031d0| 74 61 6e 74 20 73 65 63 | 6f 6e 64 20 74 6f 20 61 |tant sec|ond to a|
|000031e0| 73 6b 69 6e 67 20 51 75 | 69 63 6b 44 72 61 77 2c |sking Qu|ickDraw,|
|000031f0| 20 62 75 74 20 69 73 20 | 73 6f 6d 65 74 69 6d 65 | but is |sometime|
|00003200| 73 20 6e 65 63 65 73 73 | 61 72 79 2e 0d 48 6f 77 |s necess|ary..How|
|00003210| 20 74 6f 20 66 69 6e 64 | 20 62 61 73 65 20 73 63 | to find| base sc|
|00003220| 72 65 65 6e 65 72 73 0d | 54 68 65 20 65 61 73 69 |reeners.|The easi|
|00003230| 65 73 74 20 77 61 79 20 | 74 6f 20 66 69 6e 64 20 |est way |to find |
|00003240| 62 61 73 65 20 73 63 72 | 65 65 6e 65 72 73 20 69 |base scr|eeners i|
|00003250| 73 20 74 6f 20 72 75 6e | 20 74 68 65 20 6f 66 66 |s to run| the off|
|00003260| 65 6e 64 69 6e 67 20 70 | 72 6f 67 72 61 6d 20 6f |ending p|rogram o|
|00003270| 6e 20 6d 61 63 68 69 6e | 65 73 20 74 68 61 74 20 |n machin|es that |
|00003280| 68 61 76 65 20 64 69 66 | 66 65 72 65 6e 74 20 73 |have dif|ferent s|
|00003290| 63 72 65 65 6e 20 61 64 | 64 72 65 73 73 65 73 2e |creen ad|dresses.|
|000032a0| 20 49 66 20 61 6e 79 20 | 61 64 64 72 65 73 73 65 | If any |addresse|
|000032b0| 73 20 61 72 65 20 62 65 | 69 6e 67 20 75 73 65 64 |s are be|ing used|
|000032c0| 20 69 6e 20 61 20 62 61 | 73 65 20 6d 61 6e 6e 65 | in a ba|se manne|
|000032d0| 72 2c 20 74 68 65 20 73 | 79 73 74 65 6d 20 77 69 |r, the s|ystem wi|
|000032e0| 6c 6c 20 75 73 75 61 6c | 6c 79 20 63 72 61 73 68 |ll usual|ly crash|
|000032f0| 2e 20 54 68 65 20 6f 66 | 66 65 6e 64 69 6e 67 20 |. The of|fending |
|00003300| 70 72 6f 67 72 61 6d 20 | 6d 61 79 20 61 6c 73 6f |program |may also|
|00003310| 20 6f 63 63 61 73 69 6f | 6e 61 6c 6c 79 20 72 65 | occasio|nally re|
|00003320| 66 75 73 65 20 74 6f 20 | 64 72 61 77 2e 20 53 6f |fuse to |draw. So|
|00003330| 6d 65 20 70 72 6f 67 72 | 61 6d 73 20 61 66 66 6c |me progr|ams affl|
|00003340| 69 63 74 65 64 20 77 69 | 74 68 20 74 68 69 73 20 |icted wi|th this |
|00003350| 70 72 6f 62 6c 65 6d 20 | 6d 61 79 20 61 6c 73 6f |problem |may also|
|00003360| 20 68 61 6e 67 20 74 68 | 65 20 63 6f 6d 70 75 74 | hang th|e comput|
|00003370| 65 72 20 28 73 6f 6d 65 | 74 69 6d 65 73 20 6b 6e |er (some|times kn|
|00003380| 6f 77 6e 20 61 73 20 61 | 63 63 65 73 73 69 6e 67 |own as a|ccessing|
|00003390| 20 66 75 6e 6e 79 20 73 | 70 61 63 65 29 2e 20 41 | funny s|pace). A|
|000033a0| 6c 73 6f 2c 20 64 6f 20 | 61 20 67 6c 6f 62 61 6c |lso, do |a global|
|000033b0| 20 66 69 6e 64 20 6f 6e | 20 74 68 65 20 73 6f 75 | find on| the sou|
|000033c0| 72 63 65 20 63 6f 64 65 | 20 74 6f 20 6c 6f 6f 6b |rce code| to look|
|000033d0| 20 66 6f 72 20 6e 75 6d | 62 65 72 73 20 6c 69 6b | for num|bers lik|
|000033e0| 65 20 24 37 41 37 30 30 | 20 6f 72 20 24 31 41 37 |e $7A700| or $1A7|
|000033f0| 30 30 2e 20 57 68 65 6e | 20 66 6f 75 6e 64 2c 20 |00. When| found, |
|00003400| 65 78 65 72 63 69 73 65 | 20 63 61 75 74 69 6f 6e |exercise| caution|
|00003410| 20 77 68 69 6c 65 20 61 | 6c 74 65 72 69 6e 67 20 | while a|ltering |
|00003420| 74 68 65 20 6f 66 66 65 | 6e 64 69 6e 67 20 6c 69 |the offe|nding li|
|00003430| 6e 65 73 2e 0d 41 73 73 | 75 6d 69 6e 67 20 74 68 |nes..Ass|uming th|
|00003440| 61 74 20 72 6f 77 62 79 | 74 65 73 20 69 73 20 65 |at rowby|tes is e|
|00003450| 71 75 61 6c 20 74 6f 20 | 74 68 65 20 77 69 64 74 |qual to |the widt|
|00003460| 68 20 6f 66 20 74 68 65 | 20 73 63 72 65 65 6e 0d |h of the| screen.|
|00003470| 41 63 63 6f 72 64 69 6e | 67 20 74 6f 20 74 68 65 |Accordin|g to the|
|00003480| 20 64 65 66 69 6e 69 74 | 69 6f 6e 20 6f 66 20 61 | definit|ion of a|
|00003490| 20 62 69 74 4d 61 70 20 | 66 6f 75 6e 64 20 69 6e | bitMap |found in|
|000034a0| 20 49 6e 73 69 64 65 20 | 4d 61 63 69 6e 74 6f 73 | Inside |Macintos|
|000034b0| 68 20 28 70 20 49 2d 31 | 34 34 29 2c 20 79 6f 75 |h (p I-1|44), you|
|000034c0| 20 63 61 6e 20 73 65 65 | 20 74 68 61 74 20 72 6f | can see| that ro|
|000034d0| 77 42 79 74 65 73 20 69 | 73 20 74 68 65 20 6e 75 |wBytes i|s the nu|
|000034e0| 6d 62 65 72 20 6f 66 20 | 61 63 74 75 61 6c 20 62 |mber of |actual b|
|000034f0| 79 74 65 73 20 69 6e 20 | 6d 65 6d 6f 72 79 20 74 |ytes in |memory t|
|00003500| 68 61 74 20 61 72 65 20 | 75 73 65 64 20 74 6f 20 |hat are |used to |
|00003510| 64 65 74 65 72 6d 69 6e | 65 20 74 68 65 20 62 69 |determin|e the bi|
|00003520| 74 4d 61 70 2e 20 57 65 | 20 6b 6e 6f 77 20 74 68 |tMap. We| know th|
|00003530| 65 20 73 63 72 65 65 6e | 20 69 73 20 6a 75 73 74 |e screen| is just|
|00003540| 20 61 20 62 69 67 20 68 | 75 6e 6b 20 6f 66 20 6d | a big h|unk of m|
|00003550| 65 6d 6f 72 79 2c 20 61 | 6e 64 20 77 65 20 6b 6e |emory, a|nd we kn|
|00003560| 6f 77 20 74 68 61 74 20 | 51 75 69 63 6b 44 72 61 |ow that |QuickDra|
|00003570| 77 20 75 73 65 73 20 74 | 68 61 74 20 6d 65 6d 6f |w uses t|hat memo|
|00003580| 72 79 20 61 73 20 61 20 | 62 69 74 4d 61 70 2e 20 |ry as a |bitMap. |
|00003590| 72 6f 77 42 79 74 65 73 | 20 61 63 63 6f 6d 70 6c |rowBytes| accompl|
|000035a0| 69 73 68 65 73 20 74 68 | 65 20 74 72 61 6e 73 6c |ishes th|e transl|
|000035b0| 61 74 69 6f 6e 20 6f 66 | 20 61 20 62 69 67 20 68 |ation of| a big h|
|000035c0| 75 6e 6b 20 6f 66 20 6d | 65 6d 6f 72 79 20 69 6e |unk of m|emory in|
|000035d0| 74 6f 20 61 20 62 69 74 | 4d 61 70 2e 20 54 6f 20 |to a bit|Map. To |
|000035e0| 64 6f 20 74 68 69 73 2c | 20 72 6f 77 42 79 74 65 |do this,| rowByte|
|000035f0| 73 20 74 65 6c 6c 73 20 | 74 68 65 20 73 79 73 74 |s tells |the syst|
|00003600| 65 6d 20 68 6f 77 20 6c | 6f 6e 67 20 61 20 67 69 |em how l|ong a gi|
|00003610| 76 65 6e 20 72 6f 77 20 | 69 73 20 69 6e 20 6d 65 |ven row |is in me|
|00003620| 6d 6f 72 79 20 61 6e 64 | 2c 20 6d 6f 72 65 20 69 |mory and|, more i|
|00003630| 6d 70 6f 72 74 61 6e 74 | 6c 79 2c 20 77 68 65 72 |mportant|ly, wher|
|00003640| 65 20 69 6e 20 6d 65 6d | 6f 72 79 20 74 68 65 20 |e in mem|ory the |
|00003650| 6e 65 78 74 20 72 6f 77 | 20 73 74 61 72 74 73 2e |next row| starts.|
|00003660| 20 46 6f 72 20 63 6f 6e | 76 65 6e 74 69 6f 6e 61 | For con|ventiona|
|00003670| 6c 20 4d 61 63 69 6e 74 | 6f 73 68 65 73 2c 20 72 |l Macint|oshes, r|
|00003680| 6f 77 42 79 74 65 73 20 | 28 62 79 74 65 73 20 70 |owBytes |(bytes p|
|00003690| 65 72 20 52 6f 77 29 20 | 2a 20 38 20 28 50 69 78 |er Row) |* 8 (Pix|
|000036a0| 65 6c 73 20 70 65 72 20 | 42 79 74 65 29 20 67 69 |els per |Byte) gi|
|000036b0| 76 65 73 20 74 68 65 20 | 66 69 6e 61 6c 20 68 6f |ves the |final ho|
|000036c0| 72 69 7a 6f 6e 74 61 6c | 20 77 69 64 74 68 20 6f |rizontal| width o|
|000036d0| 66 20 74 68 65 20 73 63 | 72 65 65 6e 20 61 73 20 |f the sc|reen as |
|000036e0| 50 69 78 65 6c 73 20 70 | 65 72 20 52 6f 77 2e 20 |Pixels p|er Row. |
|000036f0| 54 68 69 73 20 64 6f 65 | 73 20 6e 6f 74 20 68 61 |This doe|s not ha|
|00003700| 76 65 20 74 6f 20 62 65 | 20 74 68 65 20 63 61 73 |ve to be| the cas|
|00003710| 65 2e 20 49 74 20 69 73 | 20 70 6f 73 73 69 62 6c |e. It is| possibl|
|00003720| 65 20 74 6f 20 68 61 76 | 65 20 61 20 4d 61 63 69 |e to hav|e a Maci|
|00003730| 6e 74 6f 73 68 20 73 63 | 72 65 65 6e 20 77 68 65 |ntosh sc|reen whe|
|00003740| 72 65 20 74 68 65 20 72 | 6f 77 42 79 74 65 73 20 |re the r|owBytes |
|00003750| 65 78 74 65 6e 64 73 20 | 62 65 79 6f 6e 64 20 77 |extends |beyond w|
|00003760| 68 61 74 20 69 73 20 61 | 63 74 75 61 6c 6c 79 20 |hat is a|ctually |
|00003770| 76 69 73 69 62 6c 65 20 | 6f 6e 20 74 68 65 20 73 |visible |on the s|
|00003780| 63 72 65 65 6e 2e 20 59 | 6f 75 20 63 61 6e 20 74 |creen. Y|ou can t|
|00003790| 68 69 6e 6b 20 6f 66 20 | 69 74 20 61 73 20 68 61 |hink of |it as ha|
|000037a0| 76 69 6e 67 20 74 68 65 | 20 73 63 72 65 65 6e 20 |ving the| screen |
|000037b0| 6c 6f 6f 6b 69 6e 67 20 | 69 6e 20 6f 6e 20 61 20 |looking |in on a |
|000037c0| 6c 61 72 67 65 72 20 62 | 69 74 4d 61 70 2e 20 44 |larger b|itMap. D|
|000037d0| 69 61 67 72 61 6d 6d 61 | 74 69 63 61 6c 6c 79 2c |iagramma|tically,|
|000037e0| 20 69 74 20 6d 69 67 68 | 74 20 6c 6f 6f 6b 20 6c | it migh|t look l|
|000037f0| 69 6b 65 3a 0d 57 69 74 | 68 20 61 6e 20 55 6c 74 |ike:.Wit|h an Ult|
|00003800| 72 61 2d 4c 61 72 67 65 | 20 73 63 72 65 65 6e 2c |ra-Large| screen,|
|00003810| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 62 | the num|ber of b|
|00003820| 79 74 65 73 20 75 73 65 | 64 20 66 6f 72 20 73 63 |ytes use|d for sc|
|00003830| 72 65 65 6e 20 6d 65 6d | 6f 72 79 20 6d 61 79 20 |reen mem|ory may |
|00003840| 62 65 20 69 6e 20 74 68 | 65 20 35 30 30 2c 30 30 |be in th|e 500,00|
|00003850| 30 20 62 79 74 65 20 72 | 61 6e 67 65 2e 20 57 68 |0 byte r|ange. Wh|
|00003860| 65 6e 65 76 65 72 20 63 | 61 6c 63 75 6c 61 74 69 |enever c|alculati|
|00003870| 6f 6e 73 20 61 72 65 20 | 62 65 69 6e 67 20 6d 61 |ons are |being ma|
|00003880| 64 65 20 74 6f 20 66 69 | 6e 64 20 76 61 72 69 6f |de to fi|nd vario|
|00003890| 75 73 20 6c 6f 63 61 74 | 69 6f 6e 73 20 69 6e 20 |us locat|ions in |
|000038a0| 74 68 65 20 73 63 72 65 | 65 6e 2c 20 74 68 65 20 |the scre|en, the |
|000038b0| 76 61 72 69 61 62 6c 65 | 73 20 75 73 65 64 20 73 |variable|s used s|
|000038c0| 68 6f 75 6c 64 20 62 65 | 20 61 62 6c 65 20 74 6f |hould be| able to|
|000038d0| 20 68 61 6e 64 6c 65 20 | 6c 61 72 67 65 72 20 73 | handle |larger s|
|000038e0| 63 72 65 65 6e 20 73 69 | 7a 65 73 2e 20 46 6f 72 |creen si|zes. For|
|000038f0| 20 65 78 61 6d 70 6c 65 | 2c 20 61 20 31 36 20 62 | example|, a 16 b|
|00003900| 69 74 20 49 6e 74 65 67 | 65 72 20 77 69 6c 6c 20 |it Integ|er will |
|00003910| 6e 6f 74 20 62 65 20 61 | 62 6c 65 20 74 6f 20 68 |not be a|ble to h|
|00003920| 6f 6c 64 20 74 68 65 20 | 35 30 30 2c 30 30 30 20 |old the |500,000 |
|00003930| 6e 75 6d 62 65 72 2c 20 | 73 6f 20 61 20 4c 6f 6e |number, |so a Lon|
|00003940| 67 49 6e 74 20 77 6f 75 | 6c 64 20 62 65 20 72 65 |gInt wou|ld be re|
|00003950| 71 75 69 72 65 64 2e 20 | 20 44 6f 20 6e 6f 74 20 |quired. | Do not |
|00003960| 61 73 73 75 6d 65 20 74 | 68 61 74 20 74 68 65 20 |assume t|hat the |
|00003970| 73 63 72 65 65 6e 20 73 | 69 7a 65 20 69 73 20 32 |screen s|ize is 2|
|00003980| 31 2c 38 38 38 20 62 79 | 74 65 73 20 6c 6f 6e 67 |1,888 by|tes long|
|00003990| 2e 20 20 62 69 74 4d 61 | 70 73 20 63 61 6e 20 62 |. bitMa|ps can b|
|000039a0| 65 20 6c 61 72 67 65 72 | 20 74 68 61 6e 20 33 32 |e larger| than 32|
|000039b0| 4b 20 6f 72 20 36 34 4b | 2e 0d 57 68 79 20 69 74 |K or 64K|..Why it|
|000039c0| d5 73 20 42 61 64 0d 50 | 72 6f 67 72 61 6d 73 20 |.s Bad.P|rograms |
|000039d0| 74 68 61 74 20 61 73 73 | 75 6d 65 20 74 68 61 74 |that ass|ume that|
|000039e0| 20 61 6c 6c 20 6f 66 20 | 74 68 65 20 62 79 74 65 | all of |the byte|
|000039f0| 73 20 69 6e 20 61 20 72 | 6f 77 20 61 72 65 20 76 |s in a r|ow are v|
|00003a00| 69 73 69 62 6c 65 20 6d | 61 79 20 6d 61 6b 65 20 |isible m|ay make |
|00003a10| 62 61 64 20 63 61 6c 63 | 75 6c 61 74 69 6f 6e 73 |bad calc|ulations|
|00003a20| 2c 20 63 61 75 73 69 6e | 67 20 64 72 61 77 69 6e |, causin|g drawin|
|00003a30| 67 20 72 6f 75 74 69 6e | 65 73 20 74 6f 20 70 72 |g routin|es to pr|
|00003a40| 6f 64 75 63 65 20 75 6e | 75 73 75 61 6c 2c 20 61 |oduce un|usual, a|
|00003a50| 6e 64 20 75 6e 72 65 61 | 64 61 62 6c 65 2c 20 72 |nd unrea|dable, r|
|00003a60| 65 73 75 6c 74 73 2e 20 | 20 41 6c 73 6f 2c 20 70 |esults. | Also, p|
|00003a70| 72 6f 67 72 61 6d 73 20 | 74 68 61 74 20 75 73 65 |rograms |that use|
|00003a80| 20 74 68 65 20 72 6f 77 | 42 79 74 65 73 20 74 6f | the row|Bytes to|
|00003a90| 20 66 69 67 75 72 65 20 | 6f 75 74 20 74 68 65 20 | figure |out the |
|00003aa0| 77 69 64 74 68 20 6f 66 | 20 74 68 65 20 73 63 72 |width of| the scr|
|00003ab0| 65 65 6e 20 72 65 63 74 | 61 6e 67 6c 65 20 77 69 |een rect|angle wi|
|00003ac0| 6c 6c 20 66 69 6e 64 20 | 74 68 61 74 20 74 68 65 |ll find |that the|
|00003ad0| 69 72 20 63 61 6c 63 75 | 6c 61 74 65 64 20 72 65 |ir calcu|lated re|
|00003ae0| 63 74 61 6e 67 6c 65 20 | 69 73 20 6e 6f 74 20 74 |ctangle |is not t|
|00003af0| 68 65 20 72 65 61 6c 20 | 73 63 72 65 65 6e 42 69 |he real |screenBi|
|00003b00| 74 73 2e 42 6f 75 6e 64 | 73 2e 20 20 44 72 61 77 |ts.Bound|s. Draw|
|00003b10| 69 6e 67 20 69 6e 74 6f | 20 61 72 65 61 73 20 74 |ing into| areas t|
|00003b20| 68 61 74 20 61 72 65 20 | 6e 6f 74 20 76 69 73 69 |hat are |not visi|
|00003b30| 62 6c 65 20 77 69 6c 6c | 20 6e 6f 74 20 6e 65 63 |ble will| not nec|
|00003b40| 65 73 73 61 72 69 6c 79 | 20 63 72 61 73 68 20 74 |essarily| crash t|
|00003b50| 68 65 20 63 6f 6d 70 75 | 74 65 72 2c 20 62 75 74 |he compu|ter, but|
|00003b60| 20 69 74 20 77 69 6c 6c | 20 70 72 6f 62 61 62 6c | it will| probabl|
|00003b70| 79 20 67 69 76 65 20 65 | 72 72 6f 6e 65 6f 75 73 |y give e|rroneous|
|00003b80| 20 72 65 73 75 6c 74 73 | 2c 20 61 6e 64 20 64 69 | results|, and di|
|00003b90| 73 70 6c 61 79 73 20 74 | 68 61 74 20 64 6f 6e d5 |splays t|hat don.|
|00003ba0| 74 20 6d 61 74 63 68 20 | 74 68 65 20 6e 6f 72 6d |t match |the norm|
|00003bb0| 61 6c 20 6f 75 74 70 75 | 74 20 6f 66 20 74 68 65 |al outpu|t of the|
|00003bc0| 20 70 72 6f 67 72 61 6d | 2e 0d 50 72 6f 67 72 61 | program|..Progra|
|00003bd0| 6d 73 20 74 68 61 74 20 | 61 73 73 75 6d 65 20 74 |ms that |assume t|
|00003be0| 68 61 74 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |hat the |number o|
|00003bf0| 66 20 62 79 74 65 73 20 | 69 6e 20 74 68 65 20 73 |f bytes |in the s|
|00003c00| 63 72 65 65 6e 20 6d 65 | 6d 6f 72 79 20 77 69 6c |creen me|mory wil|
|00003c10| 6c 20 62 65 20 6c 65 73 | 73 20 74 68 61 6e 20 33 |l be les|s than 3|
|00003c20| 32 37 36 38 20 6d 61 79 | 20 68 61 76 65 20 70 72 |2768 may| have pr|
|00003c30| 6f 62 6c 65 6d 73 20 64 | 72 61 77 69 6e 67 20 69 |oblems d|rawing i|
|00003c40| 6e 74 6f 20 55 6c 74 72 | 61 2d 4c 61 72 67 65 20 |nto Ultr|a-Large |
|00003c50| 73 63 72 65 65 6e 73 2c | 20 73 69 6e 63 65 20 74 |screens,| since t|
|00003c60| 68 6f 73 65 20 73 63 72 | 65 65 6e 73 20 77 69 6c |hose scr|eens wil|
|00003c70| 6c 20 6f 66 74 65 6e 20 | 68 61 76 65 20 6d 6f 72 |l often |have mor|
|00003c80| 65 20 6d 65 6d 6f 72 79 | 20 74 68 61 6e 20 61 20 |e memory| than a |
|00003c90| 6e 6f 72 6d 61 6c 20 4d | 61 63 69 6e 74 6f 73 68 |normal M|acintosh|
|00003ca0| 20 73 63 72 65 65 6e 2e | 20 20 54 68 65 73 65 20 | screen.| These |
|00003cb0| 70 61 72 74 69 63 75 6c | 61 72 20 70 72 6f 62 6c |particul|ar probl|
|00003cc0| 65 6d 73 20 64 6f 20 6e | 6f 74 20 65 76 69 64 65 |ems do n|ot evide|
|00003cd0| 6e 63 65 20 74 68 65 6d | 73 65 6c 76 65 73 20 62 |nce them|selves b|
|00003ce0| 79 20 63 72 61 73 68 69 | 6e 67 20 74 68 65 20 73 |y crashi|ng the s|
|00003cf0| 79 73 74 65 6d 2e 20 20 | 54 68 65 79 20 67 65 6e |ystem. |They gen|
|00003d00| 65 72 61 6c 6c 79 20 61 | 70 70 65 61 72 20 61 73 |erally a|ppear as|
|00003d10| 20 6c 6f 73 73 20 6f 66 | 20 66 75 6e 63 74 69 6f | loss of| functio|
|00003d20| 6e 61 6c 69 74 79 20 28 | 6e 6f 74 20 62 65 69 6e |nality (|not bein|
|00003d30| 67 20 61 62 6c 65 20 74 | 6f 20 6d 6f 76 65 20 61 |g able t|o move a|
|00003d40| 20 77 69 6e 64 6f 77 20 | 74 6f 20 74 68 65 20 62 | window |to the b|
|00003d50| 6f 74 74 6f 6d 20 6f 66 | 20 74 68 65 20 73 63 72 |ottom of| the scr|
|00003d60| 65 65 6e 29 2c 20 6f 72 | 20 61 73 20 64 72 61 77 |een), or| as draw|
|00003d70| 69 6e 67 20 72 6f 75 74 | 69 6e 65 73 20 74 68 61 |ing rout|ines tha|
|00003d80| 74 20 6e 6f 20 6c 6f 6e | 67 65 72 20 6c 6f 6f 6b |t no lon|ger look|
|00003d90| 20 63 6f 72 72 65 63 74 | 2e 20 20 54 68 65 73 65 | correct|. These|
|00003da0| 20 70 72 6f 62 6c 65 6d | 73 20 63 61 6e 20 70 72 | problem|s can pr|
|00003db0| 65 76 65 6e 74 20 61 6e | 20 6f 74 68 65 72 77 69 |event an| otherwi|
|00003dc0| 73 65 20 77 6f 6e 64 65 | 72 66 75 6c 20 70 72 6f |se wonde|rful pro|
|00003dd0| 67 72 61 6d 20 66 72 6f | 6d 20 62 65 69 6e 67 20 |gram fro|m being |
|00003de0| 75 73 65 64 2e 0d 48 6f | 77 20 74 6f 20 61 76 6f |used..Ho|w to avo|
|00003df0| 69 64 20 62 65 69 6e 67 | 20 61 20 72 6f 77 20 62 |id being| a row b|
|00003e00| 79 74 65 72 0d 49 6e 20 | 61 6e 79 20 63 61 6c 63 |yter.In |any calc|
|00003e10| 75 6c 61 74 69 6f 6e 73 | 2c 20 74 68 65 20 72 6f |ulations|, the ro|
|00003e20| 77 42 79 74 65 73 20 76 | 61 72 69 61 62 6c 65 20 |wBytes v|ariable |
|00003e30| 73 68 6f 75 6c 64 20 62 | 65 20 74 68 6f 75 67 68 |should b|e though|
|00003e40| 74 20 6f 66 20 61 73 20 | 74 68 65 20 77 61 79 20 |t of as |the way |
|00003e50| 74 6f 20 67 65 74 20 74 | 6f 20 74 68 65 20 6e 65 |to get t|o the ne|
|00003e60| 78 74 20 72 6f 77 20 6f | 6e 20 74 68 65 20 73 63 |xt row o|n the sc|
|00003e70| 72 65 65 6e 2e 20 20 54 | 68 69 73 20 69 73 20 64 |reen. T|his is d|
|00003e80| 69 73 74 69 6e 63 74 20 | 66 72 6f 6d 20 74 68 69 |istinct |from thi|
|00003e90| 6e 6b 69 6e 67 20 6f 66 | 20 69 74 20 61 73 20 74 |nking of| it as t|
|00003ea0| 68 65 20 77 69 64 74 68 | 20 6f 66 20 74 68 65 20 |he width| of the |
|00003eb0| 73 63 72 65 65 6e 2e 20 | 20 54 68 65 20 77 69 64 |screen. | The wid|
|00003ec0| 74 68 20 73 68 6f 75 6c | 64 20 61 6c 77 61 79 73 |th shoul|d always|
|00003ed0| 20 62 65 20 66 6f 75 6e | 64 20 66 72 6f 6d 20 73 | be foun|d from s|
|00003ee0| 63 72 65 65 6e 42 69 74 | 73 2e 62 6f 75 6e 64 73 |creenBit|s.bounds|
|00003ef0| 2e 72 69 67 68 74 d0 20 | 73 63 72 65 65 6e 42 69 |.right. |screenBi|
|00003f00| 74 73 2e 62 6f 75 6e 64 | 73 2e 6c 65 66 74 2e 20 |ts.bound|s.left. |
|00003f10| 20 20 0d 49 74 20 69 73 | 20 61 6c 73 6f 20 69 6e | .It is| also in|
|00003f20| 61 70 70 72 6f 70 72 69 | 61 74 65 20 74 6f 20 75 |appropri|ate to u|
|00003f30| 73 65 20 74 68 65 20 72 | 65 63 74 61 6e 67 6c 65 |se the r|ectangle|
|00003f40| 20 74 6f 20 64 65 63 69 | 64 65 20 68 6f 77 20 6d | to deci|de how m|
|00003f50| 61 6e 79 20 62 79 74 65 | 73 20 74 68 65 72 65 20 |any byte|s there |
|00003f60| 61 72 65 20 6f 6e 20 61 | 20 72 6f 77 2e 20 20 50 |are on a| row. P|
|00003f70| 72 6f 67 72 61 6d 73 20 | 74 68 61 74 20 64 6f 20 |rograms |that do |
|00003f80| 73 6f 6d 65 74 68 69 6e | 67 20 6c 69 6b 65 3a 0d |somethin|g like:.|
|00003f90| 09 62 79 74 65 73 4c 69 | 6e 65 20 3a 3d 20 73 63 |.bytesLi|ne := sc|
|00003fa0| 72 65 65 6e 42 69 74 73 | 2e 62 6f 75 6e 64 73 2e |reenBits|.bounds.|
|00003fb0| 72 69 67 68 74 20 44 49 | 56 20 38 3b 20 20 7b 20 |right DI|V 8; { |
|00003fc0| 62 61 64 20 75 73 65 20 | 6f 66 20 62 6f 75 6e 64 |bad use |of bound|
|00003fd0| 73 20 7d 0d 09 72 69 67 | 68 74 53 69 64 65 20 3a |s }..rig|htSide :|
|00003fe0| 3d 20 73 63 72 65 65 6e | 42 69 74 73 2e 72 6f 77 |= screen|Bits.row|
|00003ff0| 42 79 74 65 73 20 2a 20 | 38 3b 20 20 20 20 20 20 |Bytes * |8; |
|00004000| 20 20 7b 20 62 61 64 20 | 75 73 65 20 6f 66 20 72 | { bad |use of r|
|00004010| 6f 77 42 79 74 65 73 20 | 7d 0d 77 69 6c 6c 20 66 |owBytes |}.will f|
|00004020| 69 6e 64 20 74 68 61 74 | 20 74 68 65 20 73 63 72 |ind that| the scr|
|00004030| 65 65 6e 20 6d 61 79 20 | 68 61 76 65 20 6d 6f 72 |een may |have mor|
|00004040| 65 20 72 6f 77 42 79 74 | 65 73 20 74 68 61 6e 20 |e rowByt|es than |
|00004050| 70 72 65 76 69 6f 75 73 | 6c 79 20 74 68 6f 75 67 |previous|ly thoug|
|00004060| 68 74 2e 20 20 54 68 65 | 20 62 65 73 74 20 77 61 |ht. The| best wa|
|00004070| 79 20 74 6f 20 61 76 6f | 69 64 20 62 65 69 6e 67 |y to avo|id being|
|00004080| 20 61 20 72 6f 77 20 62 | 79 74 65 72 20 69 73 20 | a row b|yter is |
|00004090| 74 6f 20 75 73 65 20 74 | 68 65 20 70 72 6f 70 65 |to use t|he prope|
|000040a0| 72 20 76 61 72 69 61 62 | 6c 65 73 20 66 6f 72 20 |r variab|les for |
|000040b0| 74 68 65 20 70 72 6f 70 | 65 72 20 74 68 69 6e 67 |the prop|er thing|
|000040c0| 73 2e 20 20 57 69 74 68 | 6f 75 74 20 74 68 65 20 |s. With|out the |
|000040d0| 70 72 6f 70 65 72 20 6d | 61 74 68 65 6d 61 74 69 |proper m|athemati|
|000040e0| 63 61 6c 20 62 61 73 69 | 73 20 74 6f 20 74 68 65 |cal basi|s to the|
|000040f0| 20 73 63 72 65 65 6e 2c | 20 6c 69 66 65 20 62 65 | screen,| life be|
|00004100| 63 6f 6d 65 73 20 6d 75 | 63 68 20 6d 6f 72 65 20 |comes mu|ch more |
|00004110| 64 69 66 66 69 63 75 6c | 74 2e 20 20 41 6c 77 61 |difficul|t. Alwa|
|00004120| 79 73 20 64 6f 20 74 68 | 69 6e 67 73 20 6c 69 6b |ys do th|ings lik|
|00004130| 65 3a 0d 09 62 79 74 65 | 73 4c 69 6e 65 20 3a 3d |e:..byte|sLine :=|
|00004140| 20 73 63 72 65 65 6e 42 | 69 74 73 2e 72 6f 77 42 | screenB|its.rowB|
|00004150| 79 74 65 73 3b 20 20 20 | 20 20 20 7b 20 61 6c 77 |ytes; | { alw|
|00004160| 61 79 73 20 74 68 65 20 | 63 6f 72 72 65 63 74 20 |ays the |correct |
|00004170| 6e 75 6d 62 65 72 20 7d | 0d 09 72 69 67 68 74 53 |number }|..rightS|
|00004180| 69 64 65 20 3a 3d 20 73 | 63 72 65 65 6e 42 69 74 |ide := s|creenBit|
|00004190| 73 2e 62 6f 75 6e 64 73 | 2e 72 69 67 68 74 3b 20 |s.bounds|.right; |
|000041a0| 20 7b 20 61 6c 77 61 79 | 73 20 74 68 65 20 63 6f | { alway|s the co|
|000041b0| 72 72 65 63 74 20 73 63 | 72 65 65 6e 20 73 69 7a |rrect sc|reen siz|
|000041c0| 65 20 7d 0d 49 74 20 69 | 73 20 73 6f 6d 65 74 69 |e }.It i|s someti|
|000041d0| 6d 65 73 20 6e 65 63 65 | 73 73 61 72 79 20 74 6f |mes nece|ssary to|
|000041e0| 20 64 6f 20 63 61 6c 63 | 75 6c 61 74 69 6f 6e 73 | do calc|ulations|
|000041f0| 20 69 6e 76 6f 6c 76 69 | 6e 67 20 74 68 65 20 73 | involvi|ng the s|
|00004200| 63 72 65 65 6e 2e 20 20 | 49 66 20 73 6f 2c 20 62 |creen. |If so, b|
|00004210| 65 20 73 75 72 65 20 74 | 6f 20 75 73 65 20 4c 6f |e sure t|o use Lo|
|00004220| 6e 67 49 6e 74 73 20 66 | 6f 72 20 61 6c 6c 20 74 |ngInts f|or all t|
|00004230| 68 65 20 6d 61 74 68 2c | 20 61 6e 64 20 62 65 20 |he math,| and be |
|00004240| 73 75 72 65 20 74 6f 20 | 75 73 65 20 74 68 65 20 |sure to |use the |
|00004250| 72 69 67 68 74 20 76 61 | 72 69 61 62 6c 65 73 20 |right va|riables |
|00004260| 28 69 2e 65 2e 20 75 73 | 65 20 4c 6f 6e 67 49 6e |(i.e. us|e LongIn|
|00004270| 74 73 29 2e 20 20 46 6f | 72 20 65 78 61 6d 70 6c |ts). Fo|r exampl|
|00004280| 65 2c 20 69 66 20 77 65 | 20 6e 65 65 64 20 74 6f |e, if we| need to|
|00004290| 20 66 69 6e 64 20 74 68 | 65 20 61 64 64 72 65 73 | find th|e addres|
|000042a0| 73 20 6f 66 20 74 68 65 | 20 35 30 30 74 68 20 72 |s of the| 500th r|
|000042b0| 6f 77 20 69 6e 20 74 68 | 65 20 73 63 72 65 65 6e |ow in th|e screen|
|000042c0| 20 28 35 30 30 20 6c 69 | 6e 65 73 20 66 72 6f 6d | (500 li|nes from|
|000042d0| 20 74 68 65 20 74 6f 70 | 29 3a 0d 56 41 52 09 6d | the top|):.VAR.m|
|000042e0| 79 41 64 64 72 65 73 73 | 3a 09 4c 6f 6e 67 49 6e |yAddress|:.LongIn|
|000042f0| 74 3b 0d 09 6d 79 52 6f | 77 3a 09 4c 6f 6e 67 49 |t;..myRo|w:.LongI|
|00004300| 6e 74 3b 09 09 7b 20 73 | 6f 20 74 68 65 20 63 61 |nt;..{ s|o the ca|
|00004310| 6c 63 75 6c 61 74 69 6f | 6e 73 20 64 6f 6e d5 74 |lculatio|ns don.t|
|00004320| 20 72 6f 75 6e 64 20 6f | 66 66 2e 20 7d 0d 09 6d | round o|ff. }..m|
|00004330| 79 4f 66 66 73 65 74 3a | 09 4c 6f 6e 67 49 6e 74 |yOffset:|.LongInt|
|00004340| 3b 09 7b 20 63 6f 75 6c | 64 20 65 61 73 69 6c 79 |;.{ coul|d easily|
|00004350| 20 62 65 20 6f 76 65 72 | 20 33 32 37 36 38 20 2e | be over| 32768 .|
|00004360| 2e 2e 20 7d 0d 09 62 79 | 74 65 73 4c 69 6e 65 3a |.. }..by|tesLine:|
|00004370| 09 4c 6f 6e 67 49 6e 74 | 3b 0d 09 6d 79 41 64 64 |.LongInt|;..myAdd|
|00004380| 72 65 73 73 20 3a 3d 20 | 6f 72 64 34 28 73 63 72 |ress := |ord4(scr|
|00004390| 65 65 6e 42 69 74 73 2e | 62 61 73 65 41 64 64 72 |eenBits.|baseAddr|
|000043a0| 29 3b 7b 73 74 61 72 74 | 20 77 2f 74 68 65 20 72 |);{start| w/the r|
|000043b0| 65 61 6c 20 62 61 73 65 | 20 61 64 64 72 65 73 73 |eal base| address|
|000043c0| 20 7d 0d 09 6d 79 52 6f | 77 20 3a 3d 20 35 30 30 | }..myRo|w := 500|
|000043d0| 3b 20 20 20 09 09 09 20 | 20 20 7b 74 68 65 20 72 |; ... | {the r|
|000043e0| 6f 77 20 77 65 20 77 61 | 6e 74 20 74 6f 20 61 64 |ow we wa|nt to ad|
|000043f0| 64 72 65 73 73 20 7d 0d | 09 62 79 74 65 73 4c 69 |dress }.|.bytesLi|
|00004400| 6e 65 20 3a 3d 20 73 63 | 72 65 65 6e 42 69 74 73 |ne := sc|reenBits|
|00004410| 2e 72 6f 77 42 79 74 65 | 73 3b 20 20 20 20 20 20 |.rowByte|s; |
|00004420| 7b 74 68 65 20 72 65 61 | 6c 20 62 79 74 65 73 20 |{the rea|l bytes |
|00004430| 70 65 72 20 6c 69 6e 65 | 20 7d 0d 09 6d 79 4f 66 |per line| }..myOf|
|00004440| 66 73 65 74 20 3a 3d 20 | 6d 79 52 6f 77 20 2a 20 |fset := |myRow * |
|00004450| 62 79 74 65 73 4c 69 6e | 65 3b 20 20 20 20 09 20 |bytesLin|e; . |
|00004460| 20 20 7b 6c 69 6e 65 73 | 20 2a 20 62 79 74 65 73 | {lines| * bytes|
|00004470| 20 70 65 72 20 6c 69 6e | 65 73 20 67 69 76 65 73 | per lin|es gives|
|00004480| 20 62 79 74 65 73 20 7d | 0d 09 6d 79 41 64 64 72 | bytes }|..myAddr|
|00004490| 65 73 73 20 3a 3d 20 6d | 79 41 64 64 72 65 73 73 |ess := m|yAddress|
|000044a0| 20 2b 20 6d 79 4f 66 66 | 73 65 74 3b 09 20 20 20 | + myOff|set;. |
|000044b0| 7b 66 69 6e 61 6c 20 61 | 64 64 72 65 73 73 20 6f |{final a|ddress o|
|000044c0| 66 20 74 68 65 20 35 30 | 30 74 68 20 6c 69 6e 65 |f the 50|0th line|
|000044d0| 20 7d 0d 54 68 69 73 20 | 69 73 20 6e 6f 74 20 73 | }.This |is not s|
|000044e0| 6f 6d 65 74 68 69 6e 67 | 20 79 6f 75 20 77 61 6e |omething| you wan|
|000044f0| 74 20 74 6f 20 64 6f 20 | 69 66 20 79 6f 75 20 63 |t to do |if you c|
|00004500| 61 6e 20 70 6f 73 73 69 | 62 6c 79 20 61 76 6f 69 |an possi|bly avoi|
|00004510| 64 20 69 74 2c 20 62 75 | 74 20 69 66 20 79 6f 75 |d it, bu|t if you|
|00004520| 20 73 69 6d 70 6c 79 20 | 6d 75 73 74 20 67 6f 20 | simply |must go |
|00004530| 64 69 72 65 63 74 6c 79 | 20 74 6f 20 74 68 65 20 |directly| to the |
|00004540| 73 63 72 65 65 6e 2c 20 | 62 65 20 63 61 72 65 66 |screen, |be caref|
|00004550| 75 6c 2e 20 20 54 68 65 | 20 62 69 67 2d 73 63 72 |ul. The| big-scr|
|00004560| 65 65 6e 20 6d 61 63 68 | 69 6e 65 73 20 28 55 6c |een mach|ines (Ul|
|00004570| 74 72 61 2d 4c 61 72 67 | 65 20 73 63 72 65 65 6e |tra-Larg|e screen|
|00004580| 73 29 20 77 69 6c 6c 20 | 74 68 61 6e 6b 20 79 6f |s) will |thank yo|
|00004590| 75 20 66 6f 72 20 69 74 | 2e 20 20 49 66 20 51 75 |u for it|. If Qu|
|000045a0| 69 63 6b 44 72 61 77 20 | 63 61 6e 6e 6f 74 20 62 |ickDraw |cannot b|
|000045b0| 65 20 69 6e 69 74 69 61 | 6c 69 7a 65 64 2c 20 74 |e initia|lized, t|
|000045c0| 68 65 72 65 20 69 73 20 | 61 6c 73 6f 20 74 68 65 |here is |also the|
|000045d0| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 67 6c 6f 62 | low-mem|ory glob|
|000045e0| 61 6c 20 73 63 72 65 65 | 6e 52 6f 77 20 28 61 20 |al scree|nRow (a |
|000045f0| 77 6f 72 64 20 61 74 20 | 24 31 30 36 29 20 74 68 |word at |$106) th|
|00004600| 61 74 20 77 69 6c 6c 20 | 67 69 76 65 20 79 6f 75 |at will |give you|
|00004610| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 72 6f 77 | the cur|rent row|
|00004620| 42 79 74 65 73 2e 20 20 | 0d 48 6f 77 20 74 6f 20 |Bytes. |.How to |
|00004630| 66 69 6e 64 20 72 6f 77 | 20 62 79 74 65 72 73 0d |find row| byters.|
|00004640| 54 6f 20 66 69 6e 64 20 | 63 75 72 72 65 6e 74 20 |To find |current |
|00004650| 70 72 6f 62 6c 65 6d 73 | 20 77 69 74 68 20 72 6f |problems| with ro|
|00004660| 77 20 62 79 74 65 72 20 | 70 72 6f 67 72 61 6d 73 |w byter |programs|
|00004670| 2c 20 72 75 6e 20 74 68 | 65 6d 20 6f 6e 20 61 20 |, run th|em on a |
|00004680| 6d 61 63 68 69 6e 65 20 | 65 71 75 69 70 70 65 64 |machine |equipped|
|00004690| 20 77 69 74 68 20 55 6c | 74 72 61 2d 4c 61 72 67 | with Ul|tra-Larg|
|000046a0| 65 20 73 63 72 65 65 6e | 73 20 61 6e 64 20 73 65 |e screen|s and se|
|000046b0| 65 20 69 66 20 61 6e 79 | 20 61 6e 6f 6d 61 6c 69 |e if any| anomali|
|000046c0| 65 73 20 63 72 6f 70 20 | 75 70 2e 20 20 4c 6f 6f |es crop |up. Loo|
|000046d0| 6b 20 66 6f 72 20 64 72 | 61 77 69 6e 67 20 73 65 |k for dr|awing se|
|000046e0| 71 75 65 6e 63 65 73 20 | 74 68 61 74 20 64 6f 6e |quences |that don|
|000046f0| d5 74 20 77 6f 72 6b 20 | 72 69 67 68 74 2c 20 61 |.t work |right, a|
|00004700| 6e 64 20 66 6f 72 20 64 | 72 61 77 69 6e 67 20 74 |nd for d|rawing t|
|00004710| 68 61 74 20 63 6c 69 70 | 73 20 74 6f 20 61 6e 20 |hat clip|s to an |
|00004720| 69 6d 61 67 69 6e 61 72 | 79 20 65 64 67 65 2e 20 |imaginar|y edge. |
|00004730| 20 46 6f 72 20 73 6f 75 | 72 63 65 2d 6c 65 76 65 | For sou|rce-leve|
|00004740| 6c 20 69 6e 73 70 65 63 | 74 69 6f 6e 2c 20 6c 6f |l inspec|tion, lo|
|00004750| 6f 6b 20 66 6f 72 20 75 | 73 65 73 20 6f 66 20 74 |ok for u|ses of t|
|00004760| 68 65 20 72 6f 77 42 79 | 74 65 73 20 76 61 72 69 |he rowBy|tes vari|
|00004770| 61 62 6c 65 73 20 61 6e | 64 20 62 65 20 73 75 72 |ables an|d be sur|
|00004780| 65 20 74 68 61 74 20 74 | 68 65 79 20 61 72 65 20 |e that t|hey are |
|00004790| 62 65 69 6e 67 20 75 73 | 65 64 20 69 6e 20 61 20 |being us|ed in a |
|000047a0| 6d 61 74 68 65 6d 61 74 | 69 63 61 6c 6c 79 20 73 |mathemat|ically s|
|000047b0| 6f 75 6e 64 20 66 61 73 | 68 69 6f 6e 2e 20 20 42 |ound fas|hion. B|
|000047c0| 65 20 68 69 67 68 6c 79 | 20 73 75 73 70 69 63 69 |e highly| suspici|
|000047d0| 6f 75 73 20 6f 66 20 61 | 6e 79 20 63 6f 64 65 20 |ous of a|ny code |
|000047e0| 74 68 61 74 20 75 73 65 | 73 20 72 6f 77 42 79 74 |that use|s rowByt|
|000047f0| 65 73 20 66 6f 72 20 74 | 68 65 20 73 63 72 65 65 |es for t|he scree|
|00004800| 6e 20 77 69 64 74 68 2e | 20 20 41 6e 79 20 63 61 |n width.| Any ca|
|00004810| 6c 63 75 6c 61 74 69 6f | 6e 73 20 69 6e 76 6f 6c |lculatio|ns invol|
|00004820| 76 69 6e 67 20 74 68 6f | 73 65 20 73 79 73 74 65 |ving tho|se syste|
|00004830| 6d 20 76 61 72 69 61 62 | 6c 65 73 20 73 68 6f 75 |m variab|les shou|
|00004840| 6c 64 20 62 65 20 63 6c | 6f 73 65 6c 79 20 69 6e |ld be cl|osely in|
|00004850| 73 70 65 63 74 65 64 20 | 66 6f 72 20 72 6f 75 6e |spected |for roun|
|00004860| 64 2d 6f 66 66 20 65 72 | 72 6f 72 73 20 61 6e 64 |d-off er|rors and|
|00004870| 20 69 6d 70 72 6f 70 65 | 72 20 75 73 65 2e 20 20 | imprope|r use. |
|00004880| 53 65 61 72 63 68 20 66 | 6f 72 20 74 68 65 20 6e |Search f|or the n|
|00004890| 75 6d 62 65 72 20 38 2e | 20 20 49 66 20 69 74 20 |umber 8.| If it |
|000048a0| 69 73 20 62 65 69 6e 67 | 20 75 73 65 64 20 69 6e |is being| used in|
|000048b0| 20 61 20 63 61 6c 63 75 | 6c 61 74 69 6f 6e 20 77 | a calcu|lation w|
|000048c0| 68 65 72 65 20 69 74 20 | 69 73 20 74 68 65 20 6e |here it |is the n|
|000048d0| 75 6d 62 65 72 20 6f 66 | 20 62 69 74 73 20 70 65 |umber of| bits pe|
|000048e0| 72 20 62 79 74 65 2c 20 | 74 68 65 6e 20 77 61 74 |r byte, |then wat|
|000048f0| 63 68 20 74 68 61 74 20 | 63 6f 64 65 20 63 6c 6f |ch that |code clo|
|00004900| 73 65 6c 79 20 66 6f 72 | 20 69 6d 70 72 6f 70 65 |sely for| imprope|
|00004910| 72 20 63 6f 6e 63 65 70 | 74 75 61 6c 69 7a 61 74 |r concep|tualizat|
|00004920| 69 6f 6e 2e 20 20 54 68 | 69 73 20 69 73 20 63 6f |ion. Th|is is co|
|00004930| 64 65 20 74 68 61 74 20 | 63 6f 75 6c 64 20 6c 65 |de that |could le|
|00004940| 61 70 20 6f 75 74 20 61 | 6e 64 20 67 72 61 62 20 |ap out a|nd grab |
|00004950| 79 6f 75 20 62 79 20 74 | 68 65 20 74 68 72 6f 61 |you by t|he throa|
|00004960| 74 20 61 74 20 61 6e 79 | 74 69 6d 65 2e 20 20 42 |t at any|time. B|
|00004970| 65 20 63 61 72 65 66 75 | 6c 21 0d 09 0d 55 73 69 |e carefu|l!...Usi|
|00004980| 6e 67 20 6e 69 6c 20 48 | 61 6e 64 6c 65 73 20 6f |ng nil H|andles o|
|00004990| 72 20 6e 69 6c 20 50 6f | 69 6e 74 65 72 73 0d 41 |r nil Po|inters.A|
|000049a0| 20 6e 69 6c 20 70 6f 69 | 6e 74 65 72 20 69 73 20 | nil poi|nter is |
|000049b0| 61 20 70 6f 69 6e 74 65 | 72 20 74 68 61 74 20 68 |a pointe|r that h|
|000049c0| 61 73 20 61 20 76 61 6c | 75 65 20 6f 66 20 30 2e |as a val|ue of 0.|
|000049d0| 20 20 52 65 63 6f 67 6e | 69 7a 65 20 74 68 61 74 | Recogn|ize that|
|000049e0| 20 70 6f 69 6e 74 65 72 | 73 20 61 72 65 20 6d 65 | pointer|s are me|
|000049f0| 72 65 6c 79 20 61 64 64 | 72 65 73 73 65 73 20 69 |rely add|resses i|
|00004a00| 6e 20 6d 65 6d 6f 72 79 | 2e 20 20 54 68 69 73 20 |n memory|. This |
|00004a10| 6d 65 61 6e 73 20 74 68 | 61 74 20 61 20 6e 69 6c |means th|at a nil|
|00004a20| 20 70 6f 69 6e 74 65 72 | 20 69 73 20 70 6f 69 6e | pointer| is poin|
|00004a30| 74 69 6e 67 20 74 6f 20 | 6d 65 6d 6f 72 79 20 6c |ting to |memory l|
|00004a40| 6f 63 61 74 69 6f 6e 20 | 30 2e 20 20 41 6e 79 20 |ocation |0. Any |
|00004a50| 75 73 65 20 6f 66 20 6d | 65 6d 6f 72 79 20 6c 6f |use of m|emory lo|
|00004a60| 63 61 74 69 6f 6e 20 30 | 20 69 73 20 73 74 72 69 |cation 0| is stri|
|00004a70| 63 74 6c 79 20 66 6f 72 | 62 69 64 64 65 6e 2c 20 |ctly for|bidden, |
|00004a80| 73 69 6e 63 65 20 69 74 | 20 69 73 20 6f 77 6e 65 |since it| is owne|
|00004a90| 64 20 62 79 20 4d 6f 74 | 6f 72 6f 6c 61 2e 20 20 |d by Mot|orola. |
|00004aa0| 54 72 65 73 70 61 73 73 | 65 72 73 20 6d 61 79 20 |Trespass|ers may |
|00004ab0| 62 65 20 73 68 6f 74 20 | 6f 6e 20 73 69 67 68 74 |be shot |on sight|
|00004ac0| 2c 20 62 75 74 20 74 68 | 65 79 20 6d 61 79 20 6e |, but th|ey may n|
|00004ad0| 6f 74 20 64 69 65 20 75 | 6e 74 69 6c 20 6d 75 63 |ot die u|ntil muc|
|00004ae0| 68 20 6c 61 74 65 72 2e | 20 20 53 6f 6d 65 74 69 |h later.| Someti|
|00004af0| 6d 65 73 20 74 72 65 73 | 70 61 73 73 65 72 73 20 |mes tres|passers |
|00004b00| 61 72 65 20 6f 6e 6c 79 | 20 77 6f 75 6e 64 65 64 |are only| wounded|
|00004b10| 20 61 6e 64 20 61 63 74 | 20 73 74 72 61 6e 67 65 | and act| strange|
|00004b20| 6c 79 2e 20 20 41 6e 79 | 20 75 73 65 20 6f 66 20 |ly. Any| use of |
|00004b30| 6d 65 6d 6f 72 79 20 6c | 6f 63 61 74 69 6f 6e 20 |memory l|ocation |
|00004b40| 30 20 63 61 6e 20 62 65 | 20 63 6f 6e 73 69 64 65 |0 can be| conside|
|00004b50| 72 65 64 20 61 20 62 75 | 67 2c 20 73 69 6e 63 65 |red a bu|g, since|
|00004b60| 20 74 68 65 72 65 20 61 | 72 65 20 6e 6f 20 76 61 | there a|re no va|
|00004b70| 6c 69 64 20 72 65 61 73 | 6f 6e 73 20 66 6f 72 20 |lid reas|ons for |
|00004b80| 4d 61 63 69 6e 74 6f 73 | 68 20 70 72 6f 67 72 61 |Macintos|h progra|
|00004b90| 6d 73 20 74 6f 20 72 65 | 61 64 20 6f 72 20 77 72 |ms to re|ad or wr|
|00004ba0| 69 74 65 20 74 6f 20 74 | 68 61 74 20 6d 65 6d 6f |ite to t|hat memo|
|00004bb0| 72 79 2e 20 20 48 6f 77 | 65 76 65 72 2c 20 6e 69 |ry. How|ever, ni|
|00004bc0| 6c 20 70 6f 69 6e 74 65 | 72 73 20 74 68 65 6d 73 |l pointe|rs thems|
|00004bd0| 65 6c 76 65 73 20 61 72 | 65 20 6e 6f 74 20 6e 65 |elves ar|e not ne|
|00004be0| 63 65 73 73 61 72 69 6c | 79 20 62 61 64 2e 20 20 |cessaril|y bad. |
|00004bf0| 49 74 20 69 73 20 6f 63 | 63 61 73 69 6f 6e 61 6c |It is oc|casional|
|00004c00| 6c 79 20 6e 65 63 65 73 | 73 61 72 79 20 74 6f 20 |ly neces|sary to |
|00004c10| 70 61 73 73 20 6e 69 6c | 20 70 6f 69 6e 74 65 72 |pass nil| pointer|
|00004c20| 73 20 74 6f 20 52 4f 4d | 20 72 6f 75 74 69 6e 65 |s to ROM| routine|
|00004c30| 73 2e 20 20 54 68 69 73 | 20 73 68 6f 75 6c 64 20 |s. This| should |
|00004c40| 6e 6f 74 20 62 65 20 63 | 6f 6e 66 75 73 65 64 20 |not be c|onfused |
|00004c50| 77 69 74 68 20 72 65 61 | 64 69 6e 67 20 6f 72 20 |with rea|ding or |
|00004c60| 77 72 69 74 69 6e 67 20 | 74 6f 20 6d 65 6d 6f 72 |writing |to memor|
|00004c70| 79 20 6c 6f 63 61 74 69 | 6f 6e 20 30 2e 20 20 41 |y locati|on 0. A|
|00004c80| 20 70 6f 69 6e 74 65 72 | 20 6e 6f 72 6d 61 6c 6c | pointer| normall|
|00004c90| 79 20 70 6f 69 6e 74 73 | 20 74 6f 20 28 63 6f 6e |y points| to (con|
|00004ca0| 74 61 69 6e 73 20 74 68 | 65 20 61 64 64 72 65 73 |tains th|e addres|
|00004cb0| 73 20 6f 66 29 20 61 20 | 6c 6f 63 61 74 69 6f 6e |s of) a |location|
|00004cc0| 20 69 6e 20 6d 65 6d 6f | 72 79 2e 20 20 49 74 20 | in memo|ry. It |
|00004cd0| 63 6f 75 6c 64 20 6c 6f | 6f 6b 20 6c 69 6b 65 20 |could lo|ok like |
|00004ce0| 74 68 69 73 3a 0d 49 66 | 20 61 20 70 6f 69 6e 74 |this:.If| a point|
|00004cf0| 65 72 20 68 61 73 20 62 | 65 65 6e 20 63 6c 65 61 |er has b|een clea|
|00004d00| 72 65 64 20 74 6f 20 6e | 69 6c 2c 20 69 74 20 77 |red to n|il, it w|
|00004d10| 69 6c 6c 20 70 6f 69 6e | 74 20 74 6f 20 6d 65 6d |ill poin|t to mem|
|00004d20| 6f 72 79 20 6c 6f 63 61 | 74 69 6f 6e 20 30 2e 20 |ory loca|tion 0. |
|00004d30| 20 54 68 69 73 20 69 73 | 20 4f 4b 20 61 73 20 6c | This is| OK as l|
|00004d40| 6f 6e 67 20 61 73 20 74 | 68 65 20 70 72 6f 67 72 |ong as t|he progr|
|00004d50| 61 6d 20 64 6f 65 73 20 | 6e 6f 74 20 74 72 79 20 |am does |not try |
|00004d60| 74 6f 20 72 65 61 64 20 | 66 72 6f 6d 20 6f 72 20 |to read |from or |
|00004d70| 77 72 69 74 65 20 74 6f | 20 74 68 61 74 20 70 6f |write to| that po|
|00004d80| 69 6e 74 65 72 2e 20 20 | 41 6e 20 65 78 61 6d 70 |inter. |An examp|
|00004d90| 6c 65 20 6f 66 20 61 20 | 6e 69 6c 20 70 6f 69 6e |le of a |nil poin|
|00004da0| 74 65 72 20 63 6f 75 6c | 64 20 6c 6f 6f 6b 20 6c |ter coul|d look l|
|00004db0| 69 6b 65 3a 0d 6e 69 6c | 20 68 61 6e 64 6c 65 73 |ike:.nil| handles|
|00004dc0| 20 61 72 65 20 72 65 6c | 61 74 65 64 20 74 6f 20 | are rel|ated to |
|00004dd0| 74 68 65 20 70 72 6f 62 | 6c 65 6d 2c 20 73 69 6e |the prob|lem, sin|
|00004de0| 63 65 20 61 20 68 61 6e | 64 6c 65 20 69 73 20 6d |ce a han|dle is m|
|00004df0| 65 72 65 6c 79 20 74 68 | 65 20 61 64 64 72 65 73 |erely th|e addres|
|00004e00| 73 20 6f 66 20 61 20 70 | 6f 69 6e 74 65 72 20 28 |s of a p|ointer (|
|00004e10| 6f 72 20 61 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |or a poi|nter to |
|00004e20| 61 20 70 6f 69 6e 74 65 | 72 29 2e 20 20 41 6e 20 |a pointe|r). An |
|00004e30| 65 78 61 6d 70 6c 65 20 | 6f 66 20 77 68 61 74 20 |example |of what |
|00004e40| 61 20 6e 6f 72 6d 61 6c | 20 68 61 6e 64 6c 65 20 |a normal| handle |
|00004e50| 6d 69 67 68 74 20 6c 6f | 6f 6b 20 6c 69 6b 65 20 |might lo|ok like |
|00004e60| 69 73 3a 0d 49 66 20 74 | 68 65 20 6d 65 6d 6f 72 |is:.If t|he memor|
|00004e70| 79 20 61 74 20 30 20 63 | 6f 6e 74 61 69 6e 73 20 |y at 0 c|ontains |
|00004e80| 61 6e 20 6f 64 64 20 6e | 75 6d 62 65 72 20 28 6e |an odd n|umber (n|
|00004e90| 75 6d 65 72 69 63 61 6c | 6c 79 20 6f 64 64 29 2c |umerical|ly odd),|
|00004ea0| 20 74 68 65 6e 20 75 73 | 69 6e 67 20 69 74 20 61 | then us|ing it a|
|00004eb0| 73 20 61 20 70 6f 69 6e | 74 65 72 20 77 69 6c 6c |s a poin|ter will|
|00004ec0| 20 63 61 75 73 65 20 61 | 20 73 79 73 74 65 6d 20 | cause a| system |
|00004ed0| 65 72 72 6f 72 20 77 69 | 74 68 20 49 44 3d 32 2e |error wi|th ID=2.|
|00004ee0| 20 20 54 68 69 73 20 63 | 61 6e 20 62 65 20 76 65 | This c|an be ve|
|00004ef0| 72 79 20 75 73 65 66 75 | 6c 2c 20 73 69 6e 63 65 |ry usefu|l, since|
|00004f00| 20 74 68 61 74 20 74 65 | 6c 6c 73 20 79 6f 75 20 | that te|lls you |
|00004f10| 65 78 61 63 74 6c 79 20 | 77 68 65 72 65 20 74 68 |exactly |where th|
|00004f20| 65 20 70 72 6f 67 72 61 | 6d 20 69 73 20 75 73 69 |e progra|m is usi|
|00004f30| 6e 67 20 74 68 69 73 20 | 69 6c 6c 65 67 61 6c 20 |ng this |illegal |
|00004f40| 68 61 6e 64 6c 65 2c 20 | 6d 61 6b 69 6e 67 20 69 |handle, |making i|
|00004f50| 74 20 65 61 73 79 20 74 | 6f 20 66 69 78 2e 20 20 |t easy t|o fix. |
|00004f60| 55 6e 66 6f 72 74 75 6e | 61 74 65 6c 79 2c 20 74 |Unfortun|ately, t|
|00004f70| 68 65 72 65 20 61 72 65 | 20 63 61 73 65 73 20 77 |here are| cases w|
|00004f80| 68 65 72 65 20 69 74 20 | 69 73 20 61 70 70 72 6f |here it |is appro|
|00004f90| 70 72 69 61 74 65 20 74 | 6f 20 70 61 73 73 20 61 |priate t|o pass a|
|00004fa0| 20 6e 69 6c 20 68 61 6e | 64 6c 65 20 74 6f 20 52 | nil han|dle to R|
|00004fb0| 4f 4d 20 72 6f 75 74 69 | 6e 65 73 20 28 73 75 63 |OM routi|nes (suc|
|00004fc0| 68 20 61 73 20 47 65 74 | 53 63 72 61 70 29 2e 20 |h as Get|Scrap). |
|00004fd0| 20 54 68 65 73 65 20 63 | 61 73 65 73 20 61 72 65 | These c|ases are|
|00004fe0| 20 72 61 72 65 2c 20 61 | 6e 64 20 69 74 20 69 73 | rare, a|nd it is|
|00004ff0| 20 6e 65 76 65 72 20 6c | 65 67 61 6c 20 74 6f 20 | never l|egal to |
|00005000| 72 65 61 64 20 66 72 6f | 6d 20 6f 72 20 77 72 69 |read fro|m or wri|
|00005010| 74 65 20 74 6f 20 61 20 | 6e 69 6c 20 68 61 6e 64 |te to a |nil hand|
|00005020| 6c 65 2e 0d 54 68 65 72 | 65 20 69 73 20 61 6c 73 |le..Ther|e is als|
|00005030| 6f 20 74 68 65 20 63 61 | 73 65 20 6f 66 20 61 6e |o the ca|se of an|
|00005040| 20 65 6d 70 74 79 20 68 | 61 6e 64 6c 65 2e 20 20 | empty h|andle. |
|00005050| 41 6e 20 65 6d 70 74 79 | 20 68 61 6e 64 6c 65 20 |An empty| handle |
|00005060| 69 73 20 6f 6e 65 20 77 | 68 65 72 65 20 74 68 65 |is one w|here the|
|00005070| 20 68 61 6e 64 6c 65 20 | 69 74 73 65 6c 66 20 28 | handle |itself (|
|00005080| 74 68 65 20 66 69 72 73 | 74 20 70 6f 69 6e 74 65 |the firs|t pointe|
|00005090| 72 29 20 70 6f 69 6e 74 | 73 20 74 6f 20 61 20 76 |r) point|s to a v|
|000050a0| 61 6c 69 64 20 70 6c 61 | 63 65 20 69 6e 20 6d 65 |alid pla|ce in me|
|000050b0| 6d 6f 72 79 3b 20 74 68 | 61 74 20 70 6c 61 63 65 |mory; th|at place|
|000050c0| 20 69 6e 20 6d 65 6d 6f | 72 79 20 69 73 20 61 6c | in memo|ry is al|
|000050d0| 73 6f 20 61 20 70 6f 69 | 6e 74 65 72 2c 20 61 6e |so a poi|nter, an|
|000050e0| 64 20 69 66 20 69 74 20 | 69 73 20 6e 69 6c 20 74 |d if it |is nil t|
|000050f0| 68 65 20 65 6e 74 69 72 | 65 20 68 61 6e 64 6c 65 |he entir|e handle|
|00005100| 20 69 73 20 74 65 72 6d | 65 64 20 65 6d 70 74 79 | is term|ed empty|
|00005110| 2e 20 54 68 65 72 65 20 | 61 72 65 20 6f 63 63 61 |. There |are occa|
|00005120| 73 69 6f 6e 73 20 77 68 | 65 72 65 20 69 74 20 69 |sions wh|ere it i|
|00005130| 73 20 6e 65 63 65 73 73 | 61 72 79 20 74 6f 20 75 |s necess|ary to u|
|00005140| 73 65 20 74 68 65 20 68 | 61 6e 64 6c 65 20 69 74 |se the h|andle it|
|00005150| 73 65 6c 66 2c 20 62 75 | 74 20 75 73 69 6e 67 20 |self, bu|t using |
|00005160| 74 68 65 20 6e 69 6c 20 | 70 6f 69 6e 74 65 72 20 |the nil |pointer |
|00005170| 74 68 61 74 20 69 74 20 | 63 6f 6e 74 61 69 6e 73 |that it |contains|
|00005180| 20 69 73 20 6e 6f 74 20 | 76 61 6c 69 64 2e 20 20 | is not |valid. |
|00005190| 41 6e 20 65 78 61 6d 70 | 6c 65 20 6f 66 20 61 6e |An examp|le of an|
|000051a0| 20 65 6d 70 74 79 20 68 | 61 6e 64 6c 65 20 63 6f | empty h|andle co|
|000051b0| 75 6c 64 20 62 65 3a 0d | 57 68 79 20 69 74 d5 73 |uld be:.|Why it.s|
|000051c0| 20 42 61 64 0d 54 68 65 | 20 75 73 65 20 6f 66 20 | Bad.The| use of |
|000051d0| 6e 69 6c 20 70 6f 69 6e | 74 65 72 73 20 63 61 6e |nil poin|ters can|
|000051e0| 20 6c 65 61 64 20 74 6f | 20 74 68 65 20 75 73 65 | lead to| the use|
|000051f0| 20 6f 66 20 6d 61 6b 65 | 2d 62 65 6c 69 65 76 65 | of make|-believe|
|00005200| 20 64 61 74 61 2e 20 20 | 54 68 69 73 20 6d 61 6b | data. |This mak|
|00005210| 65 2d 62 65 6c 69 65 76 | 65 20 64 61 74 61 20 6f |e-believ|e data o|
|00005220| 66 74 65 6e 20 63 68 61 | 6e 67 65 73 20 66 6f 72 |ften cha|nges for|
|00005230| 20 64 69 66 66 65 72 65 | 6e 74 20 76 65 72 73 69 | differe|nt versi|
|00005240| 6f 6e 73 20 6f 66 20 74 | 68 65 20 63 6f 6d 70 75 |ons of t|he compu|
|00005250| 74 65 72 2e 20 20 54 68 | 69 73 20 63 68 61 6e 67 |ter. Th|is chang|
|00005260| 69 6e 67 20 64 61 74 61 | 20 6d 61 6b 65 73 20 69 |ing data| makes i|
|00005270| 74 20 64 69 66 66 69 63 | 75 6c 74 20 74 6f 20 70 |t diffic|ult to p|
|00005280| 72 65 64 69 63 74 20 77 | 68 61 74 20 77 69 6c 6c |redict w|hat will|
|00005290| 20 68 61 70 70 65 6e 20 | 77 68 65 6e 20 61 20 70 | happen |when a p|
|000052a0| 72 6f 67 72 61 6d 20 75 | 73 65 73 20 6e 69 6c 20 |rogram u|ses nil |
|000052b0| 70 6f 69 6e 74 65 72 73 | 2e 20 20 50 72 6f 67 72 |pointers|. Progr|
|000052c0| 61 6d 73 20 6d 61 79 20 | 6e 6f 74 20 63 72 61 73 |ams may |not cras|
|000052d0| 68 20 61 73 20 61 20 72 | 65 73 75 6c 74 20 6f 66 |h as a r|esult of|
|000052e0| 20 75 73 69 6e 67 20 61 | 20 6e 69 6c 20 70 6f 69 | using a| nil poi|
|000052f0| 6e 74 65 72 2c 20 61 6e | 64 20 74 68 65 79 20 6d |nter, an|d they m|
|00005300| 61 79 20 62 65 68 61 76 | 65 20 69 6e 20 61 20 63 |ay behav|e in a c|
|00005310| 6f 6e 73 69 73 74 65 6e | 74 20 66 61 73 68 69 6f |onsisten|t fashio|
|00005320| 6e 2e 20 20 54 68 69 73 | 20 64 6f 65 73 20 6e 6f |n. This| does no|
|00005330| 74 20 6d 65 61 6e 20 74 | 68 61 74 20 74 68 65 72 |t mean t|hat ther|
|00005340| 65 20 69 73 6e d5 74 20 | 61 20 62 75 67 2e 20 20 |e isn.t |a bug. |
|00005350| 54 68 69 73 20 6d 65 72 | 65 6c 79 20 6d 65 61 6e |This mer|ely mean|
|00005360| 73 20 74 68 61 74 20 74 | 68 65 20 70 72 6f 67 72 |s that t|he progr|
|00005370| 61 6d 20 69 73 20 6c 75 | 63 6b 79 2c 20 61 6e 64 |am is lu|cky, and|
|00005380| 20 74 68 61 74 20 69 74 | 20 73 68 6f 75 6c 64 20 | that it| should |
|00005390| 62 65 20 70 6c 61 79 69 | 6e 67 20 74 68 65 20 6c |be playi|ng the l|
|000053a0| 6f 74 74 65 72 79 2c 20 | 6e 6f 74 20 72 75 6e 6e |ottery, |not runn|
|000053b0| 69 6e 67 20 6f 6e 20 61 | 20 4d 61 63 69 6e 74 6f |ing on a| Macinto|
|000053c0| 73 68 2e 20 20 49 66 20 | 61 20 70 72 6f 67 72 61 |sh. If |a progra|
|000053d0| 6d 20 61 63 74 73 20 64 | 69 66 66 65 72 65 6e 74 |m acts d|ifferent|
|000053e0| 6c 79 20 6f 6e 20 64 69 | 66 66 65 72 65 6e 74 20 |ly on di|fferent |
|000053f0| 76 65 72 73 69 6f 6e 73 | 20 6f 66 20 74 68 65 20 |versions| of the |
|00005400| 4d 61 63 69 6e 74 6f 73 | 68 2c 20 79 6f 75 20 73 |Macintos|h, you s|
|00005410| 68 6f 75 6c 64 20 74 68 | 69 6e 6b 20 d2 63 6f 75 |hould th|ink .cou|
|00005420| 6c 64 20 74 68 65 72 65 | 20 62 65 20 61 20 6e 61 |ld there| be a na|
|00005430| 73 74 79 20 6e 69 6c 20 | 70 6f 69 6e 74 65 72 20 |sty nil |pointer |
|00005440| 70 72 6f 62 6c 65 6d 20 | 68 65 72 65 3f d3 20 20 |problem |here?. |
|00005450| 20 55 73 65 20 6f 66 20 | 61 20 6e 69 6c 20 68 61 | Use of |a nil ha|
|00005460| 6e 64 6c 65 20 75 73 75 | 61 6c 6c 79 20 63 75 6c |ndle usu|ally cul|
|00005470| 6d 69 6e 61 74 65 73 20 | 69 6e 20 72 65 61 64 69 |minates |in readi|
|00005480| 6e 67 20 6f 72 20 77 72 | 69 74 69 6e 67 20 74 6f |ng or wr|iting to|
|00005490| 20 6f 62 73 63 75 72 65 | 20 70 6c 61 63 65 73 20 | obscure| places |
|000054a0| 69 6e 20 6d 65 6d 6f 72 | 79 2e 20 20 41 73 20 61 |in memor|y. As a|
|000054b0| 6e 20 65 78 61 6d 70 6c | 65 3a 0d 09 56 41 52 20 |n exampl|e:..VAR |
|000054c0| 20 20 6d 79 48 61 6e 64 | 6c 65 3a 20 20 54 45 48 | myHand|le: TEH|
|000054d0| 61 6e 64 6c 65 3b 0d 09 | 6d 79 48 61 6e 64 6c 65 |andle;..|myHandle|
|000054e0| 20 3a 3d 20 6e 69 6c 3b | 0d 54 68 61 74 d5 73 20 | := nil;|.That.s |
|000054f0| 70 72 65 74 74 79 20 73 | 74 72 61 69 67 68 74 66 |pretty s|traightf|
|00005500| 6f 72 77 61 72 64 2c 20 | 73 6f 20 77 68 61 74 d5 |orward, |so what.|
|00005510| 73 20 74 68 65 20 70 72 | 6f 62 6c 65 6d 3f 20 20 |s the pr|oblem? |
|00005520| 49 66 20 79 6f 75 20 64 | 6f 20 73 6f 6d 65 74 68 |If you d|o someth|
|00005530| 69 6e 67 20 6c 69 6b 65 | 3a 0d 09 6d 79 48 61 6e |ing like|:..myHan|
|00005540| 64 6c 65 5e 5e 2e 76 69 | 65 77 52 65 63 74 20 3a |dle^^.vi|ewRect :|
|00005550| 3d 20 6d 79 52 65 63 74 | 3b 20 20 7b 20 76 65 72 |= myRect|; { ver|
|00005560| 79 20 62 61 64 20 69 64 | 65 61 20 77 69 74 68 20 |y bad id|ea with |
|00005570| 6d 79 48 61 6e 64 6c 65 | 20 3d 20 6e 69 6c 20 7d |myHandle| = nil }|
|00005580| 0d 6d 65 6d 6f 72 79 20 | 6c 6f 63 61 74 69 6f 6e |.memory |location|
|00005590| 20 7a 65 72 6f 20 77 69 | 6c 6c 20 62 65 20 75 73 | zero wi|ll be us|
|000055a0| 65 64 20 61 73 20 61 20 | 70 6f 69 6e 74 65 72 20 |ed as a |pointer |
|000055b0| 74 6f 20 67 69 76 65 20 | 74 68 65 20 61 64 64 72 |to give |the addr|
|000055c0| 65 73 73 20 6f 66 20 61 | 20 54 65 78 74 45 64 69 |ess of a| TextEdi|
|000055d0| 74 20 72 65 63 6f 72 64 | 2e 20 20 57 68 61 74 20 |t record|. What |
|000055e0| 69 66 20 74 68 61 74 20 | 6d 65 6d 6f 72 79 20 6c |if that |memory l|
|000055f0| 6f 63 61 74 69 6f 6e 20 | 70 6f 69 6e 74 73 20 74 |ocation |points t|
|00005600| 6f 20 73 6f 6d 65 74 68 | 69 6e 67 20 69 6e 20 74 |o someth|ing in t|
|00005610| 68 65 20 73 79 73 74 65 | 6d 20 68 65 61 70 3f 20 |he syste|m heap? |
|00005620| 20 57 68 61 74 20 69 66 | 20 69 74 20 70 6f 69 6e | What if| it poin|
|00005630| 74 73 20 74 6f 20 74 68 | 65 20 73 6f 75 6e 64 20 |ts to th|e sound |
|00005640| 62 75 66 66 65 72 3f 20 | 20 49 6e 20 63 61 73 65 |buffer? | In case|
|00005650| 73 20 6c 69 6b 65 20 74 | 68 65 73 65 2c 20 65 69 |s like t|hese, ei|
|00005660| 67 68 74 20 62 79 74 65 | 73 20 6f 66 20 72 65 63 |ght byte|s of rec|
|00005670| 74 61 6e 67 6c 65 20 64 | 61 74 61 20 77 69 6c 6c |tangle d|ata will|
|00005680| 20 62 65 20 77 72 69 74 | 74 65 6e 20 74 6f 20 77 | be writ|ten to w|
|00005690| 68 65 72 65 76 65 72 20 | 6d 65 6d 6f 72 79 20 6c |herever |memory l|
|000056a0| 6f 63 61 74 69 6f 6e 20 | 30 20 70 6f 69 6e 74 73 |ocation |0 points|
|000056b0| 2e 20 20 0d 55 73 65 20 | 6f 66 20 61 20 6e 69 6c |. .Use |of a nil|
|000056c0| 20 68 61 6e 64 6c 65 20 | 77 69 6c 6c 20 6e 65 76 | handle |will nev|
|000056d0| 65 72 20 62 65 20 75 73 | 65 66 75 6c 2e 20 20 54 |er be us|eful. T|
|000056e0| 68 69 73 20 6d 65 6d 6f | 72 79 20 69 73 20 72 65 |his memo|ry is re|
|000056f0| 73 65 72 76 65 64 20 61 | 6e 64 20 75 73 65 64 20 |served a|nd used |
|00005700| 62 79 20 74 68 65 20 36 | 38 30 30 30 20 66 6f 72 |by the 6|8000 for|
|00005710| 20 76 61 72 69 6f 75 73 | 20 69 6e 74 65 72 72 75 | various| interru|
|00005720| 70 74 20 76 65 63 74 6f | 72 73 20 61 6e 64 20 56 |pt vecto|rs and V|
|00005730| 61 6c 75 61 62 6c 65 20 | 53 74 75 66 66 2e 20 20 |aluable |Stuff. |
|00005740| 54 68 69 73 20 56 61 6c | 75 61 62 6c 65 20 53 74 |This Val|uable St|
|00005750| 75 66 66 20 69 73 20 63 | 6f 6d 70 6f 73 65 64 20 |uff is c|omposed |
|00005760| 6f 66 20 74 68 69 6e 67 | 73 20 74 68 61 74 20 79 |of thing|s that y|
|00005770| 6f 75 20 64 65 66 69 6e | 69 74 65 6c 79 20 64 6f |ou defin|itely do|
|00005780| 20 6e 6f 74 20 77 61 6e | 74 20 74 6f 20 63 68 61 | not wan|t to cha|
|00005790| 6e 67 65 2e 20 20 57 68 | 65 6e 20 63 68 61 6e 67 |nge. Wh|en chang|
|000057a0| 65 64 2c 20 74 68 65 20 | 36 38 30 30 30 20 66 69 |ed, the |68000 fi|
|000057b0| 6e 64 73 20 6f 75 74 2c | 20 61 6e 64 20 64 65 63 |nds out,| and dec|
|000057c0| 69 64 65 73 20 74 6f 20 | 67 65 74 20 62 61 63 6b |ides to |get back|
|000057d0| 20 61 74 20 79 6f 75 72 | 20 70 72 6f 67 72 61 6d | at your| program|
|000057e0| 20 69 6e 20 74 68 65 20 | 6d 6f 73 74 20 73 74 72 | in the |most str|
|000057f0| 61 6e 67 65 20 61 6e 64 | 20 77 6f 6e 64 65 72 66 |ange and| wonderf|
|00005800| 75 6c 20 77 61 79 73 2e | 20 20 54 68 65 73 65 20 |ul ways.| These |
|00005810| 73 74 72 61 6e 67 65 20 | 72 65 73 75 6c 74 73 20 |strange |results |
|00005820| 63 61 6e 20 72 61 6e 67 | 65 20 66 72 6f 6d 20 61 |can rang|e from a|
|00005830| 20 53 79 73 74 65 6d 20 | 45 72 72 6f 72 20 61 6c | System |Error al|
|00005840| 6c 20 74 68 65 20 77 61 | 79 20 74 6f 20 65 72 61 |l the wa|y to era|
|00005850| 73 69 6e 67 20 68 61 72 | 64 20 64 69 73 6b 73 20 |sing har|d disks |
|00005860| 61 6e 64 20 64 65 73 74 | 72 6f 79 69 6e 67 20 66 |and dest|roying f|
|00005870| 69 6c 65 73 2e 20 20 54 | 68 65 72 65 20 72 65 61 |iles. T|here rea|
|00005880| 6c 6c 79 20 69 73 20 6e | 6f 20 6c 69 6d 69 74 20 |lly is n|o limit |
|00005890| 74 6f 20 74 68 65 20 68 | 61 76 6f 63 20 74 68 61 |to the h|avoc tha|
|000058a0| 74 20 63 61 6e 20 62 65 | 20 77 72 65 61 6b 65 64 |t can be| wreaked|
|000058b0| 2e 20 20 54 68 69 73 20 | 74 65 6e 64 73 20 74 6f |. This |tends to|
|000058c0| 20 6b 65 65 70 20 74 68 | 65 20 75 73 65 72 73 20 | keep th|e users |
|000058d0| 6f 6e 20 74 68 65 20 65 | 64 67 65 20 6f 66 20 74 |on the e|dge of t|
|000058e0| 68 65 69 72 20 73 65 61 | 74 2c 20 62 75 74 20 74 |heir sea|t, but t|
|000058f0| 68 69 73 20 69 73 20 6e | 6f 74 20 72 65 61 6c 6c |his is n|ot reall|
|00005900| 79 20 74 68 65 20 64 65 | 73 69 72 65 64 20 65 66 |y the de|sired ef|
|00005910| 66 65 63 74 2e 20 20 41 | 73 20 6e 6f 74 65 64 20 |fect. A|s noted |
|00005920| 61 62 6f 76 65 2c 20 69 | 74 20 77 6f 6e d5 74 20 |above, i|t won.t |
|00005930| 6e 65 63 65 73 73 61 72 | 69 6c 79 20 63 61 75 73 |necessar|ily caus|
|00005940| 65 20 74 72 61 75 6d 61 | 74 69 63 20 72 65 73 75 |e trauma|tic resu|
|00005950| 6c 74 73 2e 20 20 41 20 | 70 72 6f 67 72 61 6d 20 |lts. A |program |
|00005960| 63 61 6e 20 62 65 20 64 | 6f 69 6e 67 20 6e 61 75 |can be d|oing nau|
|00005970| 67 68 74 79 20 74 68 69 | 6e 67 73 20 61 6e 64 20 |ghty thi|ngs and |
|00005980| 6e 6f 74 20 67 65 74 20 | 63 61 75 67 68 74 2e 20 |not get |caught. |
|00005990| 20 54 68 69 73 20 69 73 | 20 73 74 69 6c 6c 20 61 | This is| still a|
|000059a0| 20 62 75 67 20 74 68 61 | 74 20 6e 65 65 64 73 20 | bug tha|t needs |
|000059b0| 74 6f 20 62 65 20 66 69 | 78 65 64 2c 20 73 69 6e |to be fi|xed, sin|
|000059c0| 63 65 20 69 74 20 69 73 | 20 6e 65 61 72 6c 79 20 |ce it is| nearly |
|000059d0| 67 75 61 72 61 6e 74 65 | 65 64 20 74 6f 20 67 69 |guarante|ed to gi|
|000059e0| 76 65 20 64 69 66 66 65 | 72 65 6e 74 20 72 65 73 |ve diffe|rent res|
|000059f0| 75 6c 74 73 20 6f 6e 20 | 64 69 66 66 65 72 65 6e |ults on |differen|
|00005a00| 74 20 76 65 72 73 69 6f | 6e 73 20 6f 66 20 74 68 |t versio|ns of th|
|00005a10| 65 20 4d 61 63 69 6e 74 | 6f 73 68 2e 20 20 50 72 |e Macint|osh. Pr|
|00005a20| 6f 67 72 61 6d 73 20 65 | 78 68 69 62 69 74 69 6e |ograms e|xhibitin|
|00005a30| 67 20 73 63 68 69 7a 6f | 70 68 72 65 6e 69 61 20 |g schizo|phrenia |
|00005a40| 68 61 76 65 20 62 65 65 | 6e 20 70 72 6f 76 65 6e |have bee|n proven|
|00005a50| 20 74 6f 20 62 65 20 6c | 65 73 73 20 65 6e 6a 6f | to be l|ess enjo|
|00005a60| 79 61 62 6c 65 20 74 6f | 20 75 73 65 2e 0d 48 6f |yable to| use..Ho|
|00005a70| 77 20 74 6f 20 61 76 6f | 69 64 20 62 65 69 6e 67 |w to avo|id being|
|00005a80| 20 61 20 4e 69 6c 6c 65 | 72 0d 57 68 65 6e 65 76 | a Nille|r.Whenev|
|00005a90| 65 72 20 61 20 70 72 6f | 67 72 61 6d 20 75 73 65 |er a pro|gram use|
|00005aa0| 73 20 70 6f 69 6e 74 65 | 72 73 20 61 6e 64 20 68 |s pointe|rs and h|
|00005ab0| 61 6e 64 6c 65 73 2c 20 | 69 74 20 73 68 6f 75 6c |andles, |it shoul|
|00005ac0| 64 20 65 6e 73 75 72 65 | 20 74 68 61 74 20 74 68 |d ensure| that th|
|00005ad0| 65 20 70 6f 69 6e 74 65 | 72 20 6f 72 20 68 61 6e |e pointe|r or han|
|00005ae0| 64 6c 65 20 77 69 6c 6c | 20 6e 6f 74 20 62 65 20 |dle will| not be |
|00005af0| 6e 69 6c 2e 20 20 54 68 | 69 73 20 63 6f 75 6c 64 |nil. Th|is could|
|00005b00| 20 62 65 20 74 65 72 6d | 65 64 20 64 65 66 65 6e | be term|ed defen|
|00005b10| 73 69 76 65 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |sive pro|gramming|
|00005b20| 2c 20 73 69 6e 63 65 20 | 69 74 20 61 73 73 75 6d |, since |it assum|
|00005b30| 65 73 20 74 68 61 74 20 | 65 76 65 72 79 6f 6e 65 |es that |everyone|
|00005b40| 20 69 73 20 6f 75 74 20 | 74 6f 20 67 65 74 20 74 | is out |to get t|
|00005b50| 68 65 20 70 72 6f 67 72 | 61 6d 20 28 77 68 69 63 |he progr|am (whic|
|00005b60| 68 20 69 73 20 6e 6f 74 | 20 66 61 72 20 66 72 6f |h is not| far fro|
|00005b70| 6d 20 74 68 65 20 74 72 | 75 74 68 20 6f 6e 20 74 |m the tr|uth on t|
|00005b80| 68 65 20 4d 61 63 69 6e | 74 6f 73 68 29 2e 20 20 |he Macin|tosh). |
|00005b90| 59 6f 75 20 73 68 6f 75 | 6c 64 20 61 6c 77 61 79 |You shou|ld alway|
|00005ba0| 73 20 63 68 65 63 6b 20 | 74 68 65 20 72 65 73 75 |s check |the resu|
|00005bb0| 6c 74 20 6f 66 20 72 6f | 75 74 69 6e 65 73 20 74 |lt of ro|utines t|
|00005bc0| 68 61 74 20 63 6c 61 69 | 6d 20 74 6f 20 70 61 73 |hat clai|m to pas|
|00005bd0| 73 20 62 61 63 6b 20 61 | 20 68 61 6e 64 6c 65 2e |s back a| handle.|
|00005be0| 20 49 66 20 74 68 65 79 | 20 70 61 73 73 20 79 6f | If they| pass yo|
|00005bf0| 75 20 62 61 63 6b 20 61 | 20 6e 69 6c 20 68 61 6e |u back a| nil han|
|00005c00| 64 6c 65 2c 20 79 6f 75 | 20 63 6f 75 6c 64 20 67 |dle, you| could g|
|00005c10| 65 74 20 69 6e 20 74 72 | 6f 75 62 6c 65 20 69 66 |et in tr|ouble if|
|00005c20| 20 79 6f 75 20 75 73 65 | 20 74 68 65 6d 2e 20 20 | you use| them. |
|00005c30| 44 6f 6e d5 74 20 74 72 | 75 73 74 20 74 68 65 20 |Don.t tr|ust the |
|00005c40| 52 4f 4d 2e 20 20 54 68 | 65 20 66 6f 6c 6c 6f 77 |ROM. Th|e follow|
|00005c50| 69 6e 67 20 65 78 61 6d | 70 6c 65 20 6f 66 20 61 |ing exam|ple of a|
|00005c60| 20 64 65 66 65 6e 73 69 | 76 65 20 75 73 65 20 6f | defensi|ve use o|
|00005c70| 66 20 61 20 68 61 6e 64 | 6c 65 20 69 6e 76 6f 6c |f a hand|le invol|
|00005c80| 76 65 73 20 74 68 65 20 | 52 65 73 6f 75 72 63 65 |ves the |Resource|
|00005c90| 20 4d 61 6e 61 67 65 72 | 2e 20 20 54 68 65 20 52 | Manager|. The R|
|00005ca0| 65 73 6f 75 72 63 65 20 | 4d 61 6e 61 67 65 72 20 |esource |Manager |
|00005cb0| 70 61 73 73 65 73 20 62 | 61 63 6b 20 61 20 68 61 |passes b|ack a ha|
|00005cc0| 6e 64 6c 65 20 74 6f 20 | 74 68 65 20 72 65 73 6f |ndle to |the reso|
|00005cd0| 75 72 63 65 20 64 61 74 | 61 2e 20 20 54 68 65 72 |urce dat|a. Ther|
|00005ce0| 65 20 61 72 65 20 61 6e | 79 20 6e 75 6d 62 65 72 |e are an|y number|
|00005cf0| 20 6f 66 20 70 6c 61 63 | 65 73 20 77 68 65 72 65 | of plac|es where|
|00005d00| 20 69 74 20 6d 61 79 20 | 62 65 20 66 6f 72 63 65 | it may |be force|
|00005d10| 64 20 74 6f 20 70 61 73 | 73 20 62 61 63 6b 20 61 |d to pas|s back a|
|00005d20| 20 6e 69 6c 20 68 61 6e | 64 6c 65 2e 20 20 46 6f | nil han|dle. Fo|
|00005d30| 72 20 65 78 61 6d 70 6c | 65 3a 0d 09 56 41 52 20 |r exampl|e:..VAR |
|00005d40| 20 20 6d 79 52 65 7a 7a | 69 65 3a 20 20 4d 79 48 | myRezz|ie: MyH|
|00005d50| 61 6e 64 6c 65 3b 0d 09 | 6d 79 52 65 7a 7a 69 65 |andle;..|myRezzie|
|00005d60| 20 3a 3d 20 4d 79 48 61 | 6e 64 6c 65 28 47 65 74 | := MyHa|ndle(Get|
|00005d70| 52 65 73 6f 75 72 63 65 | 28 6d 79 52 65 73 54 79 |Resource|(myResTy|
|00005d80| 70 65 2c 20 6d 79 52 65 | 73 4e 75 6d 62 65 72 29 |pe, myRe|sNumber)|
|00005d90| 29 3b 20 20 20 20 7b 20 | 63 6f 75 6c 64 20 62 65 |); { |could be|
|00005da0| 20 09 09 09 09 09 09 09 | 09 09 20 20 20 20 20 20 | .......|.. |
|00005db0| 20 6d 69 73 73 69 6e 67 | c9 7d 0d 09 49 46 20 6d | missing|.}..IF m|
|00005dc0| 79 52 65 7a 7a 69 65 20 | 3d 20 6e 69 6c 20 20 54 |yRezzie |= nil T|
|00005dd0| 48 45 4e 20 20 45 72 72 | 6f 72 48 61 6e 64 6c 65 |HEN Err|orHandle|
|00005de0| 72 28 27 57 65 20 61 6c | 6d 6f 73 74 20 67 6f 74 |r('We al|most got|
|00005df0| 20 4e 69 6c 6c 65 64 27 | 29 0d 09 45 4c 53 45 20 | Nilled'|)..ELSE |
|00005e00| 20 6d 79 52 65 7a 7a 69 | 65 5e 5e 2e 6d 79 52 65 | myRezzi|e^^.myRe|
|00005e10| 63 74 20 3a 3d 20 6e 65 | 77 52 65 63 74 3b 20 20 |ct := ne|wRect; |
|00005e20| 09 20 7b 20 57 65 20 6b | 6e 6f 77 20 69 74 20 69 |. { We k|now it i|
|00005e30| 73 20 4f 4b 20 7d 0d 41 | 73 20 61 6e 6f 74 68 65 |s OK }.A|s anothe|
|00005e40| 72 20 65 78 61 6d 70 6c | 65 2c 20 74 68 69 6e 6b |r exampl|e, think|
|00005e50| 20 6f 66 20 68 6f 77 20 | 68 61 6e 64 6c 65 73 20 | of how |handles |
|00005e60| 63 61 6e 20 62 65 20 70 | 75 72 67 65 64 20 66 72 |can be p|urged fr|
|00005e70| 6f 6d 20 6d 65 6d 6f 72 | 79 20 69 6e 20 74 69 67 |om memor|y in tig|
|00005e80| 68 74 20 6d 65 6d 6f 72 | 79 20 63 6f 6e 64 69 74 |ht memor|y condit|
|00005e90| 69 6f 6e 73 2e 20 20 49 | 66 20 61 20 62 6c 6f 63 |ions. I|f a bloc|
|00005ea0| 6b 20 69 73 20 6d 61 72 | 6b 65 64 20 70 75 72 67 |k is mar|ked purg|
|00005eb0| 65 61 62 6c 65 2c 20 74 | 68 65 20 4d 65 6d 6f 72 |eable, t|he Memor|
|00005ec0| 79 20 4d 61 6e 61 67 65 | 72 20 6d 61 79 20 74 68 |y Manage|r may th|
|00005ed0| 72 6f 77 20 69 74 20 61 | 77 61 79 20 61 74 20 61 |row it a|way at a|
|00005ee0| 6e 79 20 74 69 6d 65 2e | 20 20 54 68 69 73 20 63 |ny time.| This c|
|00005ef0| 72 65 61 74 65 73 20 61 | 6e 20 65 6d 70 74 79 20 |reates a|n empty |
|00005f00| 68 61 6e 64 6c 65 2e 20 | 20 54 68 65 20 64 65 66 |handle. | The def|
|00005f10| 65 6e 73 69 76 65 20 70 | 72 6f 67 72 61 6d 6d 65 |ensive p|rogramme|
|00005f20| 72 20 77 69 6c 6c 20 61 | 6c 77 61 79 73 20 6d 61 |r will a|lways ma|
|00005f30| 6b 65 20 73 75 72 65 20 | 74 68 61 74 20 74 68 65 |ke sure |that the|
|00005f40| 20 68 61 6e 64 6c 65 73 | 20 62 65 69 6e 67 20 75 | handles| being u|
|00005f50| 73 65 64 20 61 72 65 20 | 6e 6f 74 20 65 6d 70 74 |sed are |not empt|
|00005f60| 79 2e 20 20 0d 09 56 41 | 52 20 20 20 6d 79 52 65 |y. ..VA|R myRe|
|00005f70| 7a 7a 69 65 3a 20 20 6d | 79 48 61 6e 64 6c 65 3b |zzie: m|yHandle;|
|00005f80| 0d 09 6d 79 52 65 7a 7a | 69 65 20 3a 3d 20 6d 79 |..myRezz|ie := my|
|00005f90| 48 61 6e 64 6c 65 28 47 | 65 74 52 65 73 6f 75 72 |Handle(G|etResour|
|00005fa0| 63 65 28 6d 79 52 65 73 | 54 79 70 65 2c 20 6d 79 |ce(myRes|Type, my|
|00005fb0| 52 65 73 4e 75 6d 62 65 | 72 29 29 3b 20 20 7b 20 |ResNumbe|r)); { |
|00005fc0| 63 6f 75 6c 64 20 62 65 | 20 09 09 09 09 20 20 20 |could be| .... |
|00005fd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005fe0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005ff0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6d 69 73 | | mis|
|00006000| 73 69 6e 67 c9 20 7d 0d | 09 49 46 20 6d 79 52 65 |sing. }.|.IF myRe|
|00006010| 7a 7a 69 65 20 3d 20 6e | 69 6c 20 20 54 48 45 4e |zzie = n|il THEN|
|00006020| 20 20 45 72 72 6f 72 48 | 61 6e 64 6c 65 72 28 27 | ErrorH|andler('|
|00006030| 57 65 20 61 6c 6d 6f 73 | 74 20 67 6f 74 20 4e 69 |We almos|t got Ni|
|00006040| 6c 6c 65 64 27 29 0d 09 | 45 4c 53 45 20 20 6d 79 |lled')..|ELSE my|
|00006050| 52 65 7a 7a 69 65 5e 5e | 2e 6d 79 52 65 63 74 20 |Rezzie^^|.myRect |
|00006060| 3a 3d 20 6e 65 77 52 65 | 63 74 3b 09 7b 20 57 65 |:= newRe|ct;.{ We|
|00006070| 20 6b 6e 6f 77 20 69 74 | 20 69 73 20 4f 4b 20 7d | know it| is OK }|
|00006080| 0d 09 74 65 6d 70 48 61 | 6e 64 6c 65 20 3a 3d 20 |..tempHa|ndle := |
|00006090| 4e 65 77 48 61 6e 64 6c | 65 20 28 6c 61 72 67 65 |NewHandl|e (large|
|000060a0| 42 6c 6f 63 6b 29 3b 09 | 7b 6d 69 67 68 74 20 64 |Block);.|{might d|
|000060b0| 69 73 70 6f 73 65 20 61 | 20 70 75 72 67 65 61 62 |ispose a| purgeab|
|000060c0| 6c 65 20 09 09 09 09 09 | 09 09 09 20 6d 79 52 65 |le .....|... myRe|
|000060d0| 7a 7a 69 65 7d 0d 09 49 | 46 20 6d 79 52 65 7a 7a |zzie}..I|F myRezz|
|000060e0| 69 65 5e 20 3d 20 6e 69 | 6c 20 20 54 48 45 4e 20 |ie^ = ni|l THEN |
|000060f0| 4c 6f 61 64 52 65 73 6f | 75 72 63 65 28 48 61 6e |LoadReso|urce(Han|
|00006100| 64 6c 65 28 6d 79 52 65 | 7a 7a 69 65 29 29 3b 20 |dle(myRe|zzie)); |
|00006110| 7b 52 65 2d 6c 6f 61 64 | 20 65 6d 70 74 79 09 09 |{Re-load| empty..|
|00006120| 09 09 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00006130| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00006140| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 68 61 | | ha|
|00006150| 6e 64 6c 65 7d 0d 09 49 | 46 20 52 65 73 45 72 72 |ndle}..I|F ResErr|
|00006160| 6f 72 20 3d 20 6e 6f 45 | 72 72 20 20 54 48 45 4e |or = noE|rr THEN|
|00006170| 20 0d 09 20 20 20 20 6d | 79 52 65 7a 7a 69 65 5e | .. m|yRezzie^|
|00006180| 5e 2e 53 74 61 74 75 73 | 46 69 65 6c 64 20 3a 3d |^.Status|Field :=|
|00006190| 20 4f 4b 3b 09 7b 20 67 | 75 61 72 61 6e 74 65 65 | OK;.{ g|uarantee|
|000061a0| 64 20 6e 6f 74 20 65 6d | 70 74 79 2c 20 61 6e 64 |d not em|pty, and|
|000061b0| 20 61 63 74 75 61 6c 6c | 79 20 09 09 09 20 20 20 | actuall|y ... |
|000061c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000061d0| 20 20 20 20 20 67 65 74 | 73 20 72 65 61 64 20 62 | get|s read b|
|000061e0| 61 63 6b 20 69 6e 2c 20 | 69 66 20 6e 65 63 65 73 |ack in, |if neces|
|000061f0| 73 61 72 79 20 7d 0d 42 | 65 20 65 73 70 65 63 69 |sary }.B|e especi|
|00006200| 61 6c 6c 79 20 63 61 72 | 65 66 75 6c 20 6f 66 20 |ally car|eful of |
|00006210| 70 6c 61 63 65 73 20 77 | 68 65 72 65 20 6d 65 6d |places w|here mem|
|00006220| 6f 72 79 20 69 73 20 62 | 65 69 6e 67 20 61 6c 6c |ory is b|eing all|
|00006230| 6f 63 61 74 65 64 2e 20 | 20 54 68 65 20 4e 65 77 |ocated. | The New|
|00006240| 48 61 6e 64 6c 65 20 61 | 6e 64 20 4e 65 77 50 74 |Handle a|nd NewPt|
|00006250| 72 20 63 61 6c 6c 73 20 | 77 69 6c 6c 20 72 65 74 |r calls |will ret|
|00006260| 75 72 6e 20 61 20 6e 69 | 6c 20 68 61 6e 64 6c 65 |urn a ni|l handle|
|00006270| 20 6f 72 20 70 6f 69 6e | 74 65 72 20 69 66 20 74 | or poin|ter if t|
|00006280| 68 65 72 65 20 69 73 20 | 6e 6f 74 20 65 6e 6f 75 |here is |not enou|
|00006290| 67 68 20 6d 65 6d 6f 72 | 79 2e 20 20 49 66 20 79 |gh memor|y. If y|
|000062a0| 6f 75 20 75 73 65 20 74 | 68 61 74 20 68 61 6e 64 |ou use t|hat hand|
|000062b0| 6c 65 20 6f 72 20 70 6f | 69 6e 74 65 72 20 77 69 |le or po|inter wi|
|000062c0| 74 68 6f 75 74 20 63 68 | 65 63 6b 69 6e 67 2c 20 |thout ch|ecking, |
|000062d0| 79 6f 75 20 77 69 6c 6c | 20 62 65 20 67 75 69 6c |you will| be guil|
|000062e0| 74 79 20 6f 66 20 62 65 | 69 6e 67 20 61 20 4e 69 |ty of be|ing a Ni|
|000062f0| 6c 6c 65 72 2e 0d 48 6f | 77 20 74 6f 20 66 69 6e |ller..Ho|w to fin|
|00006300| 64 20 4e 69 6c 6c 65 72 | 73 0d 54 68 65 20 62 65 |d Niller|s.The be|
|00006310| 73 74 20 77 61 79 20 74 | 6f 20 66 69 6e 64 20 74 |st way t|o find t|
|00006320| 68 65 73 65 20 6e 61 73 | 74 79 20 6e 69 6c 20 70 |hese nas|ty nil p|
|00006330| 6f 69 6e 74 65 72 20 70 | 72 6f 62 6c 65 6d 73 20 |ointer p|roblems |
|00006340| 69 73 20 74 6f 20 73 65 | 74 20 6d 65 6d 6f 72 79 |is to se|t memory|
|00006350| 20 6c 6f 63 61 74 69 6f | 6e 20 7a 65 72 6f 20 74 | locatio|n zero t|
|00006360| 6f 20 62 65 20 61 6e 20 | 6f 64 64 20 6e 75 6d 62 |o be an |odd numb|
|00006370| 65 72 20 28 61 20 67 6f | 6f 64 20 63 68 6f 69 63 |er (a go|od choic|
|00006380| 65 20 69 73 20 27 4e 49 | 4c 21 27 20 3d 20 24 34 |e is 'NI|L!' = $4|
|00006390| 45 34 39 34 43 32 31 2c | 20 77 68 69 63 68 20 69 |E494C21,| which i|
|000063a0| 73 20 6e 75 6d 65 72 69 | 63 61 6c 6c 79 20 6f 64 |s numeri|cally od|
|000063b0| 64 2c 20 61 73 20 77 65 | 6c 6c 20 61 73 20 70 65 |d, as we|ll as pe|
|000063c0| 72 73 6f 6e 61 6c 69 74 | 79 2d 77 69 73 65 29 2e |rsonalit|y-wise).|
|000063d0| 20 20 50 6c 65 61 73 65 | 20 73 65 65 20 4f 56 20 | Please| see OV |
|000063e0| 31 35 20 2d 20 44 65 62 | 75 67 67 69 6e 67 20 54 |15 - Deb|ugging T|
|000063f0| 69 70 73 20 66 6f 72 20 | 64 65 74 61 69 6c 73 20 |ips for |details |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.